How do I update the UI during an event using ASP.NET?

Posted by Phil Hale on Stack Overflow See other posts from Stack Overflow or by Phil Hale
Published on 2011-01-17T14:48:14Z Indexed on 2011/01/17 14:53 UTC
Read the original article Hit count: 240

Filed under:
|

I'm a bit stuck with a problem. I feel like the solution should be fairly straight forward but I'm completely out of ideas for some reason.

Here's the problem. I've got a user control with a couple of buttons. Think of them as 'On' and 'Off'. When either button is clicked an async method is called. If the method is successful an event is fired. Within the event I want to update the enabled property of the two buttons so that only a single button is clickable at any one time. The problem is that any changes I make to the properties are not shown on screen because the postback is already complete. I tried wrapping the buttons in an UpdatePanel but I get an "Update method can only be called on UpdatePanel with ID 'xxxx' before Render' error. I understand why the problem occurs but I can't think of a solution. Help!

Ideally what I'd like to do is simply call a method within the event that will update the UI, but I don't know if that's possible.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asynchronous