Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 显示消息错误“;“不存在”;_C#_Asp.net_Web Applications_Web - Fatal编程技术网

C# 显示消息错误“;“不存在”;

C# 显示消息错误“;“不存在”;,c#,asp.net,web-applications,web,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”的地方就是我遇到问题的地方

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;

提前感谢。

您似乎是从下载了此代码。主页上的示例似乎与实际解决方案中的代码不一致。尝试将
DisplayMessage
更改为
lblMsgSend
,看看这是否能解决问题

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

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


您的错误是什么?DisplayMessage是标记aspx页面中的控件吗?您的回答让我看到了我的解决方案。非常感谢。我忘了把标签放在我的书页上。