I have an assignment to create an ASP.NET base simple calculator with:
3 – Textboxes: FirstNumber, SecondNumber, Results
4 – Buttons: Plus, Minus, Multiply, Divide
We are to use a JavaScript callback to return the results when one of the buttons are clicked.
The issue I am having is that the values of the FirstNumber.text and SecondNumber.text are coming up as “” in the GetCallbackResult function within the code-behind. I do not know what it is I am missing. Code to follow soon.
Server-side controls are only available as part of a postback, they are not available through ajax calls, page methods etc. You'll need to update your client controls using traditional ajax (ie update them through javascript rather than setting their values
in your code behind). Or you can use an updatepanel rather than writing your own ajax code.
I'm afraid I no longer use this forum due to the new point allocation system.
None
0 Points
1 Post
TextBox text returns a null or “” value in the Code-behind when using a JavaScript callback funct...
Sep 10, 2014 11:18 AM|usacommo|LINK
I have an assignment to create an ASP.NET base simple calculator with:
3 – Textboxes: FirstNumber, SecondNumber, Results
4 – Buttons: Plus, Minus, Multiply, Divide
We are to use a JavaScript callback to return the results when one of the buttons are clicked.
The issue I am having is that the values of the FirstNumber.text and SecondNumber.text are coming up as “” in the GetCallbackResult function within the code-behind. I do not know what it is I am missing. Code to follow soon.
All-Star
37441 Points
9076 Posts
Re: TextBox text returns a null or “” value in the Code-behind when using a JavaScript callback f...
Sep 10, 2014 11:24 AM|AidyF|LINK
Server-side controls are only available as part of a postback, they are not available through ajax calls, page methods etc. You'll need to update your client controls using traditional ajax (ie update them through javascript rather than setting their values in your code behind). Or you can use an updatepanel rather than writing your own ajax code.