Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Closed Thread
Button doesn't submit form
Old 11-13-2009, 03:12 AM Button doesn't submit form
bige2533's Avatar
Skilled Talker

Posts: 79
Name: Eric
Location: Colorado
Trades: 1
I'm having an issue with IE where clicking the button won't send the email. It works fine in FF. Any ideas?

Html:
Code:
    <asp:Button onclick="sentButton_Click" type="submit" ID="sentButton" runat="server" Text="Send" 
            TabIndex="5" />
code behind:
Code:
    protected void sentButton_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                string output = "";

                MailMessage mail = new MailMessage();

                string hostAddress = "mail.trailsticker.com";

                string message = messageTextBox.Text.ToString();
                message = message.Replace(Environment.NewLine, "<br />");

                string fromEmail = emailTextBox.Text.ToString();
                string subject = subjectDropDown.Text.ToString();

                output = "<p>Name: " + nameTextBox.Text.ToString() + ".</p>";
                output += "<p>E-mail: " + emailTextBox.Text.ToString() + ".</p>";
                output += "<p>Subject: " + subjectDropDown.Text.ToString() + ".</p>";
                output += "<p>Message: " + message + ".</p>";

                mail.Subject = subject;
                mail.From = new MailAddress(fromEmail);
                mail.To.Add("xxxxxxx@trailsticker.com");
                mail.Body = message;

                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient(hostAddress);
                smtp.Send(mail);

                Response.Redirect("http://www.trailsticker.com/sent.aspx");
            }
            catch (Exception err)
            {
                notificatoinLabel.Text = "E-mail wasn't sent. There was an exception: " + err.ToString() + ".";
            }
        }
    }
__________________

Please login or register to view this content. Registration is FREE
bige2533 is offline
View Public Profile
 
 
Register now for full access!
Old 11-13-2009, 05:11 AM Re: Button doesn't submit form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And do we get to see the RENDERED HTML instead of the server side code??
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 11-13-2009, 10:50 AM Re: Button doesn't submit form
bige2533's Avatar
Skilled Talker

Posts: 79
Name: Eric
Location: Colorado
Trades: 1
That's probably a good idea. It can be seen here: http://www.trailsticker.com/contact.aspx

Or here's the code for the button.

Code:
<input type="submit" name="ctl00$ContentPlaceHolder1$sentButton" value="Send" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$sentButton&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl00_ContentPlaceHolder1_sentButton" tabindex="5" />
__________________

Please login or register to view this content. Registration is FREE

Last edited by bige2533; 11-13-2009 at 10:55 AM..
bige2533 is offline
View Public Profile
 
Old 11-16-2009, 04:26 PM Re: Button doesn't submit form
bige2533's Avatar
Skilled Talker

Posts: 79
Name: Eric
Location: Colorado
Trades: 1
I think my issue was due to a second button on the page. I removed that and it seems to work now. Must be a problem with how they submit.
__________________

Please login or register to view this content. Registration is FREE
bige2533 is offline
View Public Profile
 
Closed Thread     « Reply to Button doesn't submit form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17479 seconds with 12 queries