C# - LoadViewState And SaveViewstate?
Aug 16, 2010
I cretated my own server control (a dropdownlist) and thus my own LoadViewState and SaveViewState methods. When is the LoadViewState called? I added the control to my page and looked when the methods are called. Only the SaveViewState is called when the page is requested, LoadViewState is not. Do I have to call it manually?
View 2 Replies
Mar 1, 2011
In a project, I have made custom controls added dynamically that uses the ViewState. But for an unknown reason, I can see that SaveViewState is called more often that LoadViewState on my controls (by printing traces).During the postback, the controls ID did not change (I have checked that). I would think that we should have a call to LoadViewState for each SaveViewState. What could explain that it is not the case ?
View 1 Replies
Feb 3, 2010
can i get a value of a selected radio button in LoadViewState event of the the WebControl and how? All the components are generated in codebehind, so i have those controls:
RadioButtonList rbl;
ListItem liOne;
ListItem liTwo;
at the moment i am stuck at that the overriden LoadViewState is not being invoked
protected override void LoadViewState(object o)
{
action = rbl.SelectedValue;
action2 = rbl.SelectedItem.Value;
base.LoadViewState(o);
}
View 1 Replies
Sep 7, 2010
I can't understand why the method LoadViewState() is not called after the postback in my code below.After label1 cahnges its text the "__VIEWSTATE" hidden field is modified, but LoadViewState() is not called.
[Code]....
View 3 Replies
Apr 7, 2010
In a project of mine I dynamically create controls and add them to the nodes of a radtreeview (a control by telerik) in theLoadViewState event. By the end of this event everything seems fine, but as soon as the
Page_Load event fires the controls have disappeared. No code of mine is executed during this phase.
I'd love to know why this is the case,
View 7 Replies
Jan 27, 2011
Setup:
My page has a drop down whose values are dynamically populated. Based on which item is selected, a number of TextBoxes are dynamically created during runtime.The user then fills in information into the textboxes and clicks a submit button.
Problem:
After postback from the submit button, I need to again dynamically create the TextBoxes during Page_Init (BEFORE LoadViewState) so that after the ViewState loads, my Button_Click event can save/do whatever with the user input. PROBLEM is, I cannot recreate the textboxes based on the selection in the dropdown, because the dropdown hasn't been "selected" yet by LoadViewState.
SO, how can I read from the view state, create my textboxes, then let the viewstate populate the textboxes, and then the Button_Click will use the values??
The one thing I've attempted is to override the LoadViewState function so that I can read from the view state, create the boxes, and then load the viewstate again. This did NOT work, because the debugger never seemed to hit my overridden function.
[code]....
View 1 Replies
Jul 16, 2010
I have a problem.This particular code when used on local machine is working fine, but when it is used on serverit gives an error like " Object reference not set to an instance of an object.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object._isRefresh = _refreshState == (bool) Session["__ISREFRESH"]; "
View 1 Replies