DisplayMessage错误“​​不存在”

时间:2013-01-30 21:44:52

标签: c# asp.net web-applications web

以下是代码。它说“DisplayMessage”是我遇到问题的地方。

protected void btnSend_Click(object sender, EventArgs e)
    {
        SendMail();
        DisplayMessage.Text = "Thank you for the comment! Please hit the 'Return to Main Page' to return to the Main Page!";
        DisplayMessage.Visible = true;
        txtPhone.Text = "";
        txtEmail.Text = "";
        txtName.Text = "";
        txtComment.Text = "";
    }

我错过了某种资源吗?这就是我现在正在使用的内容。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;

提前致谢。

1 个答案:

答案 0 :(得分:1)

您好像是从codeproject下载了此代码。主页面上的示例似乎与实际解决方案中的代码对齐。尝试将DisplayMessage更改为lblMsgSend,看看是否可以修复它。

更好的是,查看ContactControl.ascx文件并查找标签ID:

<p>
    <asp:Label ID="lblMsgSend" runat="server" Visible="false" />
</p>