viewstate

viewstate failing on postback

We have a web content management system (based on Sharepoint 2007/MOSS, but for the purposes of this problem, that is not relevant, so please stick around even if you haven't worked on MOSS!). On a given page, there are conditions we cannot change: An editor clicks "Edit" and the page posts back. When it reloads in edit mode, the contr...

Viewstate fails in IE Only

I have a page which contains some search fields to query a database, and display results. The viewstate is required to retain the lists of items in dropdowns. Everything works fine in Firefox (3) & Chrome, but fails in Internet Explorer, but only sometimes (certain actions, such as resetting the form, which really just does a response.r...

Html.AntiForgeryToken() causeing errors after upgrading to .NET 3.5 SP1

I've just updated to .NET 3.5 SP1 and my once working ASP.NET MVC page has now stopped working. When trying to load a page I get the following YSOD [CryptographicException: Padding is invalid and cannot be removed.] System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCo...

Uses for MachineKey in ASP.NET

What different ways are Machine Keys useful in asp.net? I think the following are correct but thought there may be more. Multiple applications can use the same cookie Multiple servers can work with the same viewstate ...

ASP.NET Additional Partial Classes

I have a huge code behind file for one of my ASP.NET pages. It would be easier to maintain the code if I could break it up into multiple partial classes. However this is not well documented for ASP.NET. I've learned that the additional partial classes must be moved into the App_Code folder. It seems that I need to use Protected WithEve...

Why would you ever use asp.net's ViewState storage object over the Session storage object?

Other than because session storage is session-global to more than one page, why would you ever want to use the viewstate to hold values? It seems kind of ridiculous to send any kind of information other than a few small query string like values, back and forth from the client to server. I mean what a waste of bandwidth(!), simply for s...

Should I ignore the occasional Invalid viewstate error?

Every now and then (once every day or so) we're seeing the following types of errors in our logs for an ASP.NET 3.5 application Invalid viewstate Invalid postback or callback argument Are these something that "just happens" from time-to-time with an ASP.NET application? Would anyone recommend we spend a lot of time trying to diagnose...

Failed to load viewstate. Happening only occassionally. Tough to recreate

Details of Error are given below. This error happens only occasionally / rarely / sometimes and there aren't any steps to reproduce it. How can I know which Control is throwing this Viewstate error??? Error Message: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was use...

ASP.Net: Why aren't the changes I make to Viewstate in a control event available to subsequent postbacks?

I'm writing a custom control in ASP.Net 3.5 WebForms, using ASP.Net AJAX. I'm building a state toggle into the control (expanded and collapsed modes). I've been trying to keep the current state of the control in ViewState, changing it in a server-side event handler manually: object oExpanded = ViewState[ "Expandedness" ]; if(oExpanded =...

How can a custom ASP.NET control cache data without using the ViewState?

I'm not sure if this is possible in ASP.NET, but here is the problem I have: some of the data lists on my web application are displayed using a GridView; however, because some of these lists can contain a lot of data, they sometime push the page weight up into the several megabyte range due to the ViewState. Since we don't want to requer...

Invalid viewstate error

...

ViewState, UserControl and IsPostback

Basically, I have a drop down list and a dynamically added user control. The user control loads a grid view depending on the choice that was made in the drop down list. The drop down list is not part of the user control. Now, the question is, how do i simulate (isControlPostback = false) every time the user changes the selection in the ...

Running ASP.NET without viewstate turned on

We're about to start rebuilding one of our ASP.NET projects and I would like to try developing it without viestate turned on (disabled in web.config). I know about the upsides and downsides of viewstate and generally speaking what it keeps track of in comparison to control state, however I would like to know: What are the principle de...

Which controls have ViewState maintained?

I am trying to wrap my head around the control infrastructure to understand which ones ASP.NET maintains view state for. There are these regular HTML controls ex: <input type="radio" checked="checked"/> -> I understand these do not have viewstate Then there are HTML controls with runat="server" <input type="radio" checked="checked" run...

Dynamically created DropDownList loses ListItems on Postback

I have a page that contains some dynamically created controls (TextBox and DropDownList). When a postback occurs, the TextBoxes keep their values, but the DropDownLists lose their ListItems. This is quite confusing, since the page level DropDownList also keeps its ListItems. Can anyone see what's wrong with the code below? Any help in ...

Impact on performance using ASP.NET Controls

With user controls on a page, I understand that every control has an impact on memory usage by storing their own state in ViewState. My question is, how much? For example - I have a feedback form as a control on my masterpage. It is set to Visible="false" by default. A user clicks on a feedback button, and the control becomes visible wh...

Asp.net BasePage Properties using ViewState are cleared on Postback

Here are the basics of my setup: I have a BasePage class that inherits from System.Web.UI.Page. BasePage has two properties implemented such that their get/set does so from two different items in the ViewState collection (ex this.ViewState["Year"] from the BasePage). I have another class that then inherits from BasePage, lets call it ...

Can server-side viewstates fix one of the biggest problems with ASP.NET?

Hi, I've read a few SO articles about whether or not ASP.NET MVC is worth the migration from "regular" ASP.NET. One of the biggest reasons for using MVC I've seen quoted was not having to use Viewstates. However, it is possible to eliminate viewstates by storing the viewstate information on the server as this article shows. I've tried...

How to store nested CompositeControl properties in ViewState

I have a composite control that has a large number of properties that can be used to style the control. I want to group these properties yet still maintain some of the properties in the ViewState The markup for the control would look like this: e.g. <cc:Test id="test"> <Toolbar Items="add,delete" Enabled="true" /> <Grid Enable...

ViewState and dynamicly removed controls

A ASP.NET page's ViewState seems to have troubles keeping up with dynamicly removed controls and the values in them. Let's take the following code as an example: ASPX: <form id="form1" runat="server"> <div> <asp:Panel runat="server" ID="controls" /> </div> </form> CS: protected void Page_Init(object sender, EventArgs e) { B...