Hi there, im using AjaxToolKit in aspx, so a cue is how to set values to textbox? i was using javascript to retrieve values from another aspx, so now i have (for example) a sum of prices in a local var (in codebehind) and i want to set that value in a TextBox with runat="server"
I have to use jquery or javascript? with webmethods? how could be that? thanks
I also try this at codebehind :
((TextBox)FindControl("txtTotalAmount")).Text = total;
I found some tips for example, that id changes when are in html context, obviously something like
ctl00_cphMainContent_how can i tame this?
From stackoverflow
-
You can try the following steps :
- In the page load code behind, assign the ClientID property of the textbox to a javascript variable (this will allow you to access the textbox using the getElementById method)
- Use a PageMethod to retrieve the sum of prices that you want to display in the textbox
- Use getElementById(id stored in js variable in step 1) to get a handle of the textbox and then set its "value" attribute to the value returned by the PageMethod in step 2
0 comments:
Post a Comment