본문으로 바로가기
서버 콘트롤 태그가 아닌(asp:콘트롤이름) input 태그나 유저콘트롤 태그에 바인딩 구문 없이 <%= 변수 %> 로 접근할 경우 해당 변수가 바인딩이 되지 않습니다. 이럴 경우, <%# %> 바인딩 구문을 사용하여 아래와 같이 사용 합니다.

예제 소스 코드

aspx파일
<uc1:wizboard_tree ID="wizboard_tree1" SYSTEM_ID='<%# String.Format("{0}",SYSTEM_ID) %>' CONTENTS_ID='<%# String.Format("{0}",CONTENTS_ID) %>' runat="server" />

cs 파일
public string SYSTEM_ID
{
   get
   {
      if (Request["SYSTEM_ID"] == null)
          return "EP";
      else
          return Request["SYSTEM_ID"];
    }
}
public string CONTENTS_ID
{
   get
   {
      if (Request["CONTENTS_ID"] == null)
           return "EPCT1000";
      else
           return Request["CONTENTS_ID"];
   }
}
protected void Page_Load(object sender, EventArgs e)
{
     해당 콘트롤.DataBind();
}