コンボから値を変更したときにラベルを表示する必要がある ASP.Net アプリケーションがあります。
cs ファイル内:
public partial class WebFormAJAXControls : System.Web.UI.Page,System.Web.UI.ICallbackEventHandler { string _callbackArg; public void RaiseCallbackEvent(string eventArgument) { _callbackArg = eventArgument; } public string GetCallbackResult() { return _callbackArg; } protected void Page_Load(object sender, EventArgs e) { //register the name of the client side function that will be called by the server string callbackRef = Page.ClientScript.GetCallbackEventReference(this, "args", "ClientCallbackFunction",""); //define a function used by client to call server string callbackScript = " function MyServerCall(args){alert ('1'); " + callbackRef + " ; }"; //register the client function to the page Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyServerCall", callbackScript, true); } }
aspx ファイル内:
<head runat="server"> <title></title> <script type="text/javascript"> function ClientCallbackFunction(args) { alert(args); LabelMessage.innerText = args; } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownListChoice" runat="server" OnChanged="MyServerCall(DropDownListChoice.value)"> <asp:ListItem>Choise 1</asp:ListItem> <asp:ListItem>Choise 2</asp:ListItem> <asp:ListItem>Choise 3</asp:ListItem> </asp:DropDownList> <br /><br /> <asp:Label ID="labelMessage" runat="server"></asp:Label> </div> </form> </body>
コンボボックスで選択を変更すると、プログラムは何もしません。何が問題なのか教えてもらえますか?