Reputation: 1
I have a series of RadioButtons and other controls dynamically created during Page_Init. If a RadioButton meets some condition, I have it set to AutoPostBack so an event handler will be called. This works fine with the initial load, but after the page is reloaded from the post back, the RadioButton is no longer set to AutoPostBack.
This appears to work if all RadioButtons in the group are set to AutoPostBack, but I only want the specific one (typically an "Other" selection) to do that. Is there a way I can do this without setting the rest in the group?
Upvotes: 0
Views: 1087
Reputation: 3575
Page_Init is fired before the ViewState is loaded. Therefore, no controls will have their values updated to reflect the ViewState yet.
Are you doing anything in your Page_Init which is dependent on any values settable on the page? For example, are you looking to see whether the user has clicked a particular radio button? If so, you'll need to do so later in the page lifecycle, after the ViewState has been loaded (OnPreLoad, for example).
You'll enjoy ASP.NET development a LOT more, once you wrap your brain around the Page Lifecycle. Cheers!
Upvotes: 1