On page 153, a little after we start talking about dynamic loading of user controls with AJAX, you can see that we define a custom interface IDynamicControl
with a single method void FirstLoad()
. We do this so that we define a way to have our custom loaded user controls to properly execute initialization logic on very first load.
The viewstate conflict exception is not additionally included in the RadGrid section, as, considering the topic, it would be best to discuss it in a section about dynamically loaded controls and AJAX. RadGrid is not usually involved in a lot of conversations about dynamic creation and viewstate consistency.
The same ViewState disabling example applies both to a single as well as multiple user controls. You just have to have them all implement the IDynamicControl
interface to define first-run
logic. You can then load them all with the private Control LoadUserControl(Control parentControl,
string newControlPath, bool isFirstLoad)
the Telerik team