填充下拉列表时出错 [英] error in populating dropdownlist

查看:128
本文介绍了填充下拉列表时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在填充下拉列表时收到此错误.有什么建议吗?

System.Web.UI.WebControls.DropDownList

场景是,用户正在从c#页面发送信息,并将其发送到提供的电子邮件中.

继承人代码:

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:

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);
    }
}

推荐答案

感谢您的回复.我为此找到了解决方案,但我错过了将.text与其他控件一起包含的问题.欢呼!
Thanks for your reply. I got the solution for this, i missed to include .text with the other controls. cheers!


这篇关于填充下拉列表时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆