C# 显示消息错误“;“不存在”;
下面是代码。上面写着“DisplayMessage”的地方就是我遇到问题的地方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!";
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页面中的控件吗?您的回答让我看到了我的解决方案。非常感谢。我忘了把标签放在我的书页上。