By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,694 Members | 1,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,694 IT Pros & Developers. It's quick & easy.

button no longer fires - help!

P: n/a
I have a page on a customer's site - asp.net, c#, hosted on windows 2003.
There's a server-side button on the page which updates a value in a sql
database. This has worked fine for months, but mysteriously stopped working
about 10 days ago. It still works fine in my local dev environment (win xp),
and reposting the code doesn't do any good. I even tried deleting the button
and recreating it. I came up with a work around - using a linkbutton (using
the same codebehind function) to execute the database query. I asked the
hosting provider if they did anything recently to the server, and they claim
they only installed a few updates from windowsupdate.

I just noticed my own web site hosted from them has the same problem with my
contact form. My contact form has a button which uses cdo to send the
results of the form to an email address. This also worked fine up until 10
days ago.

Any ideas??? Has anybody encountered similar problems?? I'm kind of at a
loss at this point... TIA

The c# code for my page (http://www.infomend.com/contactus.aspx) is below if
it helps. Thanks!

- Chris

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Mail;

namespace infomend
{
public class contactus : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.TextBox txtCompany;
protected System.Web.UI.WebControls.TextBox txtPhone;
protected System.Web.UI.WebControls.TextBox txtEmail;
protected System.Web.UI.WebControls.DropDownList ddlTimeframe;
protected System.Web.UI.WebControls.DropDownList ddlBudget;
protected System.Web.UI.WebControls.DropDownList ddlProjectType;
protected System.Web.UI.WebControls.TextBox txtDescription;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator2;
protected System.Web.UI.WebControls.RequiredFieldValidator
RequiredFieldValidator3;
protected System.Web.UI.WebControls.TextBox txtBestTime;
protected System.Web.UI.WebControls.LinkButton lnkSubmit;
protected System.Web.UI.WebControls.Label lblResults;

private void Page_Load(object sender, System.EventArgs e)
{
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lnkSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnSubmit_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
string body = "";
body += "Name: " + this.txtName.Text + Environment.NewLine;
body += "Company: " + this.txtCompany.Text + Environment.NewLine;
body += "Phone: " + this.txtPhone.Text + Environment.NewLine;
body += "Best time to call: " + this.txtBestTime.Text +
Environment.NewLine;
body += "Email: " + this.txtEmail.Text + Environment.NewLine;
body += "Timeframe: " + this.ddlTimeframe.SelectedItem.Value +
Environment.NewLine;
body += "Budget: " + this.ddlBudget.SelectedItem.Value +
Environment.NewLine;
body += "Project Type: " + this.ddlProjectType.SelectedItem.Value +
Environment.NewLine;
body += "Description: " + this.txtDescription.Text +
Environment.NewLine;
try
{
SendEmail("sa***@infomend.com", "qu************@infomend.com", "Quote
Request",
body, MailFormat.Text);
this.lblResults.Text = "Quote processed. A sales representative will be
contacting you shortly!";
}
catch (Exception mailErr)
{
this.lblResults.Text = "Error processing quote: " +
mailErr.Message.ToString();
}
}
}

public static void SendEmail(string To, string From, string
Subject, string Body, System.Web.Mail.MailFormat Format)
{
System.Web.Mail.MailMessage Mailer = new
System.Web.Mail.MailMessage();
Mailer.From = From;
Mailer.To = To;
Mailer.Subject = Subject;
Mailer.Body = Body;
Mailer.BodyFormat = Format;
System.Web.Mail.SmtpMail.Send(Mailer);
}
}
}

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.656 / Virus Database: 421 - Release Date: 4/9/2004
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.