2014-06-21 3 views
0

레이블에 aspx 페이지 UserControl .ascx.cs에 링크를 추가하려고합니다.레이블에서 UserControl 페이지에 연결

링크 텍스트 (나는 그것을 볼 수 있습니다)이 있지만 오류는 다음과 같습니다

여기
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; 
    } 
+0

이의 .ascx에 대한 전체 코드를 제공 가지고. 마크 업 템플릿이 – Uriil

답변

0

1 확인하여 WebUserControl.ascx에 당신은 페이지의 지침에 있다고는 attribut :

Inherits="yourWebApplication.WebUserControl" 

2 체크하여 WebUserControl.ascx.designer.cs에 당신이

protected global::System.Web.UI.WebControls.Label All 
+0

인 것처럼 보입니다. 올바른지 확인하십시오. – Hamamelis