![](/img/trans.png)
[英]How To Pass Textbox Value Present In UserControl To Aspx Page Label By Clicking Button In UserControl
[英]Link in a Label to the UserControl page
我正在嘗試在Label中添加指向aspx頁面UserControl .ascx.cs的鏈接。
鏈接文本在那里(我可以看到),但是錯誤是:
CS0103: The name 'All' does not exist in the current context
這是我在代碼中所做的。
.ascx
<asp:Label ID="All" runat="server" Text="All"></asp:Label>
.ascx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
ViewState["LoginErrors"] = 0;
string UrL = "<a href='http://www.google.com'>www.google.com</a>";
All.Text = UrL;
}
1-檢查是否在Page指令中的attribut上找到了WebUserControl.ascx :
Inherits="yourWebApplication.WebUserControl"
2-檢查您的WebUserControl.ascx.designer.cs是否
protected global::System.Web.UI.WebControls.Label All
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.