인라인 코드의 일부로 FormatStatus()라는 함수가 있고 실제 정의는 코드 숨김 (C#)에있는 아래에 붙여 넣은 작업 코드가 있습니다. 내 질문은 어떻게 내가 외부 자바 스크립트 파일에 FormatStatus() 함수를 이동하면 인라인 코드에서 호출 할 수 있습니다. 뒤에inlinecode에서 자바 스크립트 함수 호출 aspx
<asp:Label ID="lblSts" runat="server" Text= '<%# FormatStatus(Eval("StsId").ToString()) %>' >
</asp:Label>
내 코드 : 단지 어떤 이벤트에서 호출 할 수있는 자바 스크립트 기능
protected string FormatStatus(string Id)
{
string formatText = string.Empty;
switch (int.Parse(Id))
{
case 0:
formatText = "New";
break;
case 1:
formatText = "Old";
break;
.....
}
return formatText;
}