Hi,
I have written c# code for ascx. I am trying to send an email on the click of image button. Please see the code below.
Here is the codebehind function which is called on submit button click.
<%@ 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
{
//fail
Response.Write(error);
}
}
}
</script>
and below is the inline coding for Image Button click event
<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>
Surprising its all working fine in Firefox but not working for internet explorer.
Please help!
Thanks. Manoj