我已經編寫了ascx的C#代碼。我正在嘗試發送一封電子郵件,其中的圖片按鈕在Mozilla Firefox中工作,但不在Internet Explorer中。.net點擊圖像按鈕不工作在Internet Explorer中,但在Firefox中
這個函數被調用按鈕點擊:
<%@ 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 = "[email protected]";
string to = "[email protected]";
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>