viewstate

Control inside EditItemTemplate will be available in Page_Load() only if...

Hello, On my page I’ve defined controls TextBox1, Label1 and GridView1. Inside GridView1 I’ve defined the following template: <asp:TemplateField> <ItemTemplate> <asp:LinkButton runat="server" Text="Edit" CommandName="Edit" ID="cmdEdit" /> </ItemTemplate> ...

Editable GridView that stores changes in viewstate until save

I know how to have an editable GridView along with a SqlDataSource in which each edit (update/insert/delete) is immediately persisted to the database (using the SqlDataSource's UpdateCommand, Insertcommand, etc). What I need now is to have an editable GridView that maintains all edits in viewstate until the user presses a "Save" button...

Masterpage Dropdown List not keeping Selected Index

Ok, my masterpage has a dropdown which controls size which affects a lot of things. I need to access the dropdown index from content pages so I do it using this code. public partial class MasterPage : System.Web.UI.MasterPage { public DropDownList MySize { get { return _ddlSize; } } } I am using Ajax and when the size changes the menu...

Minimize ViewState with TreeView

Any practical tips/tricks on how to do that? It doesn't seem that there is a lot of information about how to do that. I am loading data from the database into TreeView and the max number of nodes will be around 100. I am still interested in minimizing the ViewState. I will also be adding and deleting nodes dynamically (though the user...

TreeView manipulation, saving adding etc

Here is what I am trying to do. I have a TreeView server side control (asp.net 2.0) and I need the user to be able to add nodes to it, then after all the nodes desired are added, the data should be saved to the database. Here are some things I would like to pay attention to: 1) I don't want to save the tree data each time the new node ...

Is there a way to compute the ViewState MAC?

We are writing a proxy cache for a .NET application, and we are having problems with the ViewState MAC on the proxy. We have disabled the MAC Validation in order to get pass over this issue, but is not the best way to go (for security reasons). Is there a way to compute the ViewState MAC on the proxy in order to pass the validation? ...

Determine DDL value for dynamic column creation in oninit event

Greetings, hopefully there is a simple solution for this complex problem. Please correct any misconceptions I have along the way. A while ago I wrote a GrivView with dynamic column capability. The columns are added in the OnInit page event so that they are added BEFORE the viewstate is applied. They are reapplied on every posting in...

Repeater ChildControls ItemTemplate ViewState Persistence

Hi, I try to create a ItemTemplate for my Repeater with a tree of child controls inside an ItemTemplate. The problem is I can't find a way to persist all my controls. Each time that there is a postback, my controls are lost. I tried many things but I didn't find a way. Is anybody can help me? Here is the code that I use : Here where ...

viewstate MAC failed in asp.net 2.0 while postback the page

Hi! I have a website in asp.net 2.0 with default membership provider. It was fine til yesterday. When i add custom google search box in my website now i am getting the same error Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and vali...

ASP.Net ViewState Compression: Should I bother?

So basicaly I am working on a site that is attempting to be optimized for phones (This includes pretty much any browser enabled phone) Due to the nature of the site, I want it to load as quickly as possible. At this point, I think the page is around 30k or so in size. Now I am using viewstate, mostly for things like datagrids and not ...

Any quick way to find out if a ASP.NET control property is backed by viewstate or ordinary fields?

In all my Page_Load() events I have to do a if(!IsPostBack) { //code runs on initial get //Set properties backed by viewstate } else { //Code runs on each get and post //Set properties backed by ordinary fields } Is there any quick way to determine this short of reflector, reading documentation, or creating a test page? Is i...

What causing this "Invalid length for a Base-64 char array"

I have very little to go on here. I cant reproduce this locally, but when users get the error I get an auto email exception notification. Message: Invalid length for a Base-64 char array. Call Stack: at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.UI.Obje...

When is safe to disable viewstate?

When is safe to disable viewstate? For wich controls? Under what circunstamces? In a user control I have disabled viewstate, but if I attempt to click in this control <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" OnClientClick="return confirm('¿Está seguro que desea eliminar el mensaje?');" EnableViewStat...

Bug in Label ASP.ViewState implementation?

EDIT 2: Well, I went to the code. Note what they are doing here. They are saying load viewstate, and then turning around and setting the Text property to what was in the viewstate. After LoadViewState is called though viewstate tracking is on, and that results in the behavior I'm seeing. I think what the code should say is: if (s != Tex...

ViewState is taking 20% of my pages even though it's disabled!

I disabled viewstate in the web.config file (and there's no EnableViewState = true anywhere on the pages), but despite this, the pages are rendered with a quite large view state (8k for a 40k page). I checked the viewstate contents with a viewstate decoder and discovered that the multiview controls I'm using on my pages are the guilty on...

.Net Microsoft Ajax Viewstate Problem

An ex-colleague developed an application that was pretty much an editable grid (think timesheet). MS Ajax was used for it and the grid was wrapped in an Update panel. To make things worse the complex object graph was being saved to viewstate so every time the page refreshed i.e. a cell was updated, all the grid and viewstate would ...

What tool can I use to analyze ViewState in Asp.Net?

I apologize if the same question was asked already. I just couldn't find. Please point me to the correct question and I close this one. Can you suggest any tool that can help me to analyze ASP.NET ViewState? Thank you ...

Validation of viewstate MAC failed in Safari

Hi I have a web app using forms authentication. When I perform the following steps Let the login cookie expire Click on a link that requires a logged in user The user is redirected to the login page Click the browser back button The user is redirected to the login page again Log in using a valid username/password I get this exceptio...

Cannot serialize Object to ViewState only Session

I have a class that is marked as serializable and have no problem storing it in the Session but when I attempt to save it in the ViewState I get: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value ...

What can cause a page to lose its viewstate when doing a browser back?

I have a page which the user gets shown when he wants to create a new or edit an existing document. There are two UserControls on the page. One simple DatePicker and a more complex grid. After filling out or editing the data he then can press continue which brings him to the review page where he can decide to really create or update the ...