Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i received this error when populating the dropdownlist. any suggestion pls?

System.Web.UI.WebControls.DropDownList

the scenario is, a user is sending information from a c# page and will send it to the email provided.

heres the code:

C#
protected void btnSubmit_Click(object sender, EventArgs e)
{
    try
    {
        MailMessage Msg = new MailMessage();
        Msg.From = txtEmail.Text;
        Msg.To = txtTo.Text;
        Msg.Subject = txtSubject.Text;
        Msg.Body = "Name:" + txtFrom.Text + "Department:" + drpDep.Text;

        SmtpMail.SmtpServer = "mail.domain.com";
        SmtpMail.Send(Msg);
        Msg = null;
        //Page.RegisterStartupScript("UserMsg", "<script>alert('Mail sent thank you...');if(alert){ window.location='/ETC/';}</script>");
        Response.Redirect("../Confirmation.aspx");
    }
    catch (Exception ex)
    {
        Console.WriteLine("{0} Exception caught.", ex);
    }
}
Posted
Comments
E.F. Nijboer 14-Nov-12 5:44am    
System.Web.UI.WebControls.DropDownList is not a exception message. The given code also looks completely unrelated. It would make sense populating the DropDownList goes wrong in the coce actually populating it, this code seems completely unrelated.

1 solution

Thanks for your reply. I got the solution for this, i missed to include .text with the other controls. cheers!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900