ASP.NET 2.0, PageMethods.
Good day,
I am using ASP.NET AJAX PageMethods to dynamically change the label text when the list is modified on my page.
I know that label text is not saved between postbacks when they change on the client side, which is my business. I heard that the solution is to save the contents of the labels in a hidden field, and then set the label text from this field to Page_Load.
However, this solution seems to me not very clean. Are there other alternatives or best practices?
Thanks!
Just to clarify, I have a drop-down list with the names of people. When the drop-down list changes, I want to put the phone number of this person on the label. However, I thought full relaying wasn’t the best alternative, so I decided to get the phone using PageMethod, passing the identifier of the item selected in the drop-down list to get the phone and putting it on the shortcut.
However, since other controls cause a full postback, I lose my phone every time I postback. I know that I put it in a hidden field, and then set it back to the label in Page_Load when full feedback will be executed, but I was a word if there was another solution. Since WebMethods are marked as static, I cannot write Label.text = person.Telephone; in them.