viewstate

Completely remove ViewState for specific pages

Hi everybody, I have a site that features some pages which do not require any post-back functionality. They simply display static HTML and don't even have any associated code. However, since the Master Page has a <form runat="server"> tag which wraps all ContentPlaceHolders, the resulting HTML always contains the ViewState field, i.e: ...

sorting a gridview in class

ok i have a project which has many gridview in its pages... now i am sorting the fridveiw using the sorting function like this: protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { DataTable dt = Session["TaskTable2"] as DataTable; if (dt != null) { //Sort the data. ...

Is it normal that .Net combobox postback always contains data items?

I have a dynamically populated ComponentArt:ComboBox with Autopostback property set to true. So every time the selection changes, a postback to server would be fired. Everything seems to work fine except that the lists of all available items are also posted back to the server. from Firebug: ComboBox1_Data %3Cr%3E%3Cc%3E%3Cr%3E%3Cc%3E%...

Why SelectedIndexChanged fires for a DropDownList when a button is clicked?

I have an ASP.NET DropDownList with AutoPostBack=true and EnableViewState=false. I have a button on the page that does nothing. If I change the selection in the ddl, it posts back , which is expected. If I click the button, the page posts back and the ddl's SelectedIndexChanged fires. Why does it get fired? ...

Where does the ObjectDataSource cache data?

I'm considering using an ObjectDataSource as an intermediate between my page controls and my data access layer & object model. Traditionally I have manually created the object and populate it via a series of findcontrol statements when I need to insert/update data in the database. I'm hoping that I can use the ObjectDataSource to marsh...

LoadViewState not fired on my user control

I have a user control nested in a repeater. Inside my user control I have another repeater and in that I have a panel. I am trying to override the LoadViewState event of my user control and dynamically add controls to the panel. I want to do it in the LoadViewState so that the dynamic controls get added before the viewstate gets load...

Asp.Net MVC 2: What's the standard way to keep selected values in forms?

Say you have a few DropDownLists that filter data: Car Make: [Ford,Chevrolet,etc] Car Year: [2010, 2009, 2008, etc] Car Model: [LT, SLT, etc] And you make a selection and not show that DDL again. Is there any standard place to maintain previously selected values? This is for a "drill down" menu system. ...

Is there a tool to get the ViewState byte count for any of the major browsers?

I am looking for a tool to give me a byte count of ViewState after each postback (full or partial) to make sure that I'm not keeping any controls' states around unnecessarily. Is there a tool out there? ...

failed to load viewstate. the control tree into which viewstate

Hi Everybody, i have a gridview control . When I change page of gridview control i get this error. Server Error in '/' Application. Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding c...

Storing Data In ViewState From DataTable And Want To Back To DataTable After Inserting One More Row In DataTable

Hi I want to store data in viewstate from datatable and then want it back from viewstate to datatable. My problem: I m not able to add two rows in gridview from datatable. Plese ask for more information if not clear. ...

How do I force view-state to be loaded in an earlier stage of the page life-cycle?

I am developing a custom control that needs it's viewstate to be loaded on init. Can I antecipate the view state loading at any time? ...

ASP.NET UpdatePanel > Get selected value from checbox list outside of panel

Hi, I have a listing in an UpdatePanel I have some filters for that list in the form a checkboxList control. The checkboxList is created dynamically on page load During the Ajax update (postback), the checkbox list is not populated form the viewstate, so I cannot get the listing to filter. Note: If I put the checkbox list items directl...

Usercontrol losing Viewstate across Postback

I have a user control which uses objects as inner properties (some code is below). I am having trouble with setting the attribute of the Step class programmatically, when set programmatically it is being lost across postback which would indicate something to do with Viewstate (?). When setting the property of the Step class declarati...

asp:upload postedfile lost during postback

I am using an asp:upload control to upload an image and am using the postedfile property to insert the path to the database. In my form I have a dropdown with autopostback=true where the user can select a topic to populate a checkbox list of categories. During that postback, the postedfile value is being lost and after a little resear...

.net ViewState in page lifecycle

I have a page containing a control called PhoneInfo.ascx. PhoneInfo is dynamically created using LoadControl() and then the initControl() function is called passing in an initialization object to set some initial textbox values within PhoneInfo. The user then changes these values and hits a submit button on the page which is wired up t...

Invalid Viewstate

...

Asp.net ViewState clarification

If I disable ViewState at Page level, will it be remembered for GridView inside the page? ...

Listview Cancel/Update causes Failed Veiwstate Error

I am utilizing a asp.net Listview control which is causing a Failed to load viewstate error after a row is put in edit mode and the user clicks either update or cancel. The ListView control is in an ascx User control that is hosted in a parent aspx page. The parent aspx code-behind calls the a bind method on the ascx page which in tu...

What is an optimal value for maxPageStateFieldLength in ASP.NET

In pages that have a viewstate that spans 10-15KB what would be an optimal value for <pages maxPageStateFieldLength=""> in the web.config in order to reduce the risk of potential truncation leading to viewstate validation errors? ...

Accress Parent Page's Viewstate in ASP.NET

OK, I guess I'm missing something obvious here, but I still can't make it work... I have a page in ASP.NET. I have a nested class inside the page. I have a property in this nested class. How can I access the page's viewstate from the property's Set statement? Thanks! ...