viewstate

Conditions on the DetailsView

What is the best way of implementing conditions (requiring fields based in other fields) in a DetailsView? I have this: protected override ICollection CreateFieldSet(object dataItem, bool useDataSource) { var country = new BoundField(); country.DataField = "Country"; country.ReadOnly = ViewState["DifferentAddre...

viewstate getting bigger after postback

Interesting happened to me... I have a grid with rows of data, but the page will fail have several postback. I check it with fiddler and find that view state expands 2-3 times after each post back. The thing I did to trigger the post back is searching and sorting. I am not sure how it happens. Does anybody can give me a hint? Thank you...

avoid viewstate when post using jquery

how can i avoid or rather not send viewstate when i post from jquery? i try to put on the .aspx EnableViewState="false" but has no effect... here is how iam posting my page: var json = "{'firstname':'" + escape(firstname.val()) + "','surname':'" + surname.val() + "','day_fi':'" + day_fi.val() + "'}"; var ajaxPage = "wizard_data_proces...

Gridview SortExpression with 2 fields

Hello, I have a GridView that get's its datasource from a complex object. So I'm doing the Sorting & Paging in the code behind. <asp:GridView ID="SystemsDetailList" runat="server" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="False" ShowFooter="True" OnPageIndexChanging="gridView_PageIndexChanging" OnSorting="gridView_Sort...

ASP.Net RadioButton loses ViewState

I'm having trouble with a simple radio set of two radio buttons (I don't want to use a RadioButtonList [RBL] because RBL doesn't allow child controls, and in my case, if you select one option, I want to enable a textbox next to the button; yes you could hack this with jQuery to move the textbox, but that's dirty!). I would check one, sub...

Is there any other way to store data in web application

We use ViewState to store data that is being edited by users. However, ViewState just got too large so we really want something that is faster. We considered session, but it has to be manually collected when users travel among pages. Does anybody has suggestions? update: Actually I am using Asp.net. They reason we do not want to use s...

Is it possible to decrypt and view ViewState values?

I know there are tools out there that will let you see the content of asp.net viewstate. Is it possible to see and modify the content of viewState if it has been encrypted by adding the <machineKey ... /> node to the web.config? ...

How to disable View State MAC globally?

I'm tired of including EnableViewStateMac="false" in every page. How to do that globally? ...

datagridview viewstate question

I have a gridview in asp.net using vb 2005. on " Protected Overrides Sub Render"some of the data in the columns gets modified. when i do a view source.. and look at a column1's values it says 0010. in the render i am taking a value of ab0010 and turning it into the 0010 that is seen in the view source.. later on, there is a button_cl...

How can I clear viewstate of a dropdownlist inside a usercontrol? Should I?

I have a web user control with a dropdownlist inside of it. When the usercontrol's databind event is called, it automatically fires the dropdownlists databind event. In the dropdownlist's ondatabound event handler an 'other' option is appended to the end of the dropdownlist. The usercontrol is loaded multiple times, depending on selec...

Unable to validate data. at System.Web.Configuration.MachineKeySection.GetDecodedData

I have several websites which get approximately 3000 pageviews in total per day, and I get this viewstate error roughly 5-10 times per day, caught in global.asax: System.Web.HttpException: Unable to validate data. at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& ...

Secure to store an ID in an ASP.NET control ID?

I'm auto-generating a form in my ASP.NET page. This is already tested and working. I want to know if: If there are any security problems with storing the database ID as part of my controls ID? I can see think of 2 issues: the id will be visible in page source (not really important in this case), and the possibility someone could change...

Why do some asp.net controls keep its state although its EnableViewState property is false?

Put a textbox, a checkbox and a button on a website. Set the "EnableViewState" property of textbox and checkbox to false. Write something into textbox and check the checkbox. Click the button. Why is the textbox still written and the checkbox checked after response? ...

ViewStateMode property in Asp.Net 4.0

I haven’t yet started learning Asp.Net 4.0, but I did read a bit on ViewState, where there is a new property ViewStateMode. In earlier versions of Asp.Net, if parent control had its ViewState disabled, then child controls also had their ViewState disabled, even if their EnableViewState was set to true. a) Thus if I understand it correct...

What prevents a user from adding controls to an ASP.NET page client side?

This goes back to my other question which I thought was sufficiently answers but upon reflect am not sure that it was (sorry). Backgrounder: I am generating a form dynamically. I am pulling from the database the controls. I must associate each control with a database ID which is not the user's session id. I do this currently by storin...

Viewstate is setting control values incorrectly.

I have a page with several checkboxes on it. The checkboxes correlate to user permissions so when I change users and the page refreshes, the values of the checkboxes should change since each user is different. In spite of the fact that my code sets the value of the checkbox, viewstate or whatever changes the values to what the previous...

Viewstate in a .ashx Handler?

I've got a handler (list.ashx for example) that has a method that retrieves a large dataset, then grabs only the records that will be shown on any given "page" of data. We are allowing the users to do sorting on these results. So, on any given page run, I will be retrieving a dataset that I just got a few seconds/minutes ago, but reord...

Why does my DataGrid flat refuse to reload itself from ViewState on Postback?

I have a DataGrid control that refuses to reload itself from View State on Postback. I've traced this all the way back to the Load event on the control. It just flat refuses to reload from ViewState. It just doesn't do it. The control is situated like this: Webform --> Dynamically loaded User Control (via "LoadControl") ----> Static...

Save array in Viewstate

I have Dim a(15) as integer i wont to save this array in Viewstate . ...

Persisting a collection backed by viewstate in a CompositeControl

Maybe it's been a long day but I'm having trouble persisting a collection backed by the ASP.NET ViewState in a CompositeControl. Here's a simplified version: public class MyControl : CompositeControl { public Collection<MyObject> MyObjectCollection { get { return (Collection<MyObject>)ViewState["coll"] == null ? ...