![](/img/trans.png)
[英]ASP.NET: Gridview image issue between Internet Explorer and Firefox
[英].net click on image button not working in Internet Explorer but in Firefox
我已經為ascx編寫了C#代碼。 我試圖通過單擊圖像按鈕來發送電子郵件,該按鈕在Mozilla Firefox中有效,但在Internet Explorer中不起作用。
在單擊按鈕時調用此功能:
<%@ Control Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Globalization" %>
<script language="c#" runat="server">
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string from = "manoj.singh@espireinfo.com";
string to = "manoj.singh@espireinfo.com";
string subject = "Keep me Updated";
string sendguide = "";
if (optsendguide.Checked)
{
sendguide = "Yes Please send me";
}
else
{
sendguide = "No Please don't send me";
}
// build up the body text
string body = "<html><body>";
body += String.Format("<div>Title: {0} </div>", title.Text);
body += String.Format("<div>First Name: {0} </div>",firstname.Value);
body += String.Format("<div>Sur Name: {0} </div>", surname.Value);
body += String.Format("<div>Email address: {0} </div>", email.Value);
body += String.Format("<div>Break Type: {0} </div>", breakTypeDescription.Text);
body += String.Format("<div>Big weekends guide: {0} </div>", sendguide);
body += "</body></html>";
string error = Utilities.SendEmail(to, from, subject, body);
if (error == "") // success
{
Response.Redirect("index.aspx");
}
else // error
{
Response.Write(error);
}
}
}
</script>
標記:
<div class="form_elm_button">
<asp:ImageButton ID="SubmitButton"
runat="server"
Text="Submit"
ImageUrl="/images/17-6164button_submit.png"
OnClick="btnSubmit_Click"
CausesValidation="true"/>
</div>
在后面的代碼中,只需更改受保護的無效btnSubmit_Click(對象發送者,EventArgs e)
具有受保護的無效btnSubmit_Click(對象發送者,ImageClickEventArgs e)
為什么要使用ImageButton ...為什么不只是使用常規按鈕,並使用CSS更改背景。
全部
這段代碼在IE中工作,而不是Mozilla,有人給
document.onkeypress = KeyCheck; 函數KeyCheck(e){
var KeyID = (window.event) ? event.keyCode : e.keyCode;
if (KeyID == 0) {
var image = document.getElementById("<%= imagetirukural.ClientID%>");
var label = document.getElementById("<%= lbltirukural.ClientID%>");
if (image != null) {
document.getElementById("<%= imagetirukural.ClientID%>").style.display = "block";
InitializeTimer();
}
else {
document.getElementById("<%= lbltirukural.ClientID%>").style.display = "block";
InitializeTimer();
}
}
else if (KeyID != 0) {
if (image != null) {
document.getElementById("<%= imagetirukural.ClientID%>").style.display = "block";
}
else {
document.getElementById("<%= lbltirukural.ClientID%>").style.display = "block";
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.