【问题标题】:DisplayMessage Error "Does not exist"DisplayMessage 错误“不存在”
【发布时间】:2013-01-14 21:10:17
【问题描述】:

下面是代码。它说“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 是标记 aspx 页面中的控件吗?

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


【解决方案1】:

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

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

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

【讨论】:

  • 您的回答让我看到了我的解决方案。谢谢!我忘了把标签放在我的页面上。
猜你喜欢
  • 1970-01-01
  • 2011-10-03
  • 2014-05-15
  • 2013-02-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多