viewstate

How do I turn off viewstate for good?

Coming from a PHP background I love using clean URLs to grab data from one service to another. However, on some of my ASP.NET projects I get the horrible ViewState parameter in my URLs. Is there a way to turn this off globally? What affect will this have on my ASP.NET app? ...

Get User Input From Dynamic Controls

I am looking to create a dynamic survey. Where I generate all the question controls from the database. Below is an example of what I am trying to do (without the database part). I am able to display questions as seen below. I am unable to read the users input. Does anyone have any ideas. I have looked into the viewstate, but I ...

ViewState does not keep variables and errors out.

Let me see if I can re-word this better and maybe get some more relavent answers or ideas. This has happened a few times now as reported by users. I cannot reproduce on my local server. I am checking each of the IIS settings now to make sure they match. But on our production server here are the details: Single Server No Authentica...

Changing name of viewstate

I have two ASP.NET form living in the same page. I some problems because the hidden fields below get the same name and id. Is there some way I can change these for one of the forms? (They are also not optimal for validation). I need the services the viewstate provides, but perhaps I could disable it on form level, and use it at a lo...

ASP.NET Server Side Viewstate

I have read some approaches to storing viewstate on the server: Here is one Here is another But they are sort of complicated. I am looking for a way to persist an object without having to serialize it. I could use session state, but if a user opens more than one window, there could be overwrites of the object. Is there a simple solu...

How to diable viewstate and other hidden fields in ASP.NET

I would like to remove these hidden fields in my ASP.NET pages. Alternatively change the names or make sure the server code ignores them. (I know I will loose some functionality, but I think it is better to handle it than removing 'runat=server'. The only thing I am worried about is Updatepanel, which i really need) (The above is...

What's a good way to determine what's in my viewstate?

I have a page that has a really huge viewstate (>300KB). ...Yeah, I know. I've narrowed this anomaly down to one user control, but am having trouble determining what exactly that control is putting in there. I've overridden SavePageStateToPersistenceMedium in the page, but am not great at working with the viewstate object passed in. ...

ASP.NET MVC - Is there a way to simulate a ViewState?

Hi everyone! I have the following situation... In a certain View, the user must select the initial hour, the final hour and the weekday. But, I can't save this informations to DB 'cause I need to save my whole page and I need the primary key of the primary table, but that's not the point. So, while I don't save these data to DB, I'm sa...

ASP.NET Best way to retain label.text value between postback with PageMethods

ASP.NET 2.0, PageMethods. Good day, I'm using ASP.NET AJAX PageMethods to dynamically change the text of a Label when a dropdownlist is changed on my page. I know that the text of Labels are not retained between postbacks when they are changed on client-side, which is my case. I've heard that a solution is to keep the label content in...

toggle div visibility with a checkbox list

Hi, I have a web application(ASP.NET2.0 C#). Within it, I have a div that contains a checkbox list and a button. I want to toggle the div viewing, so I got some javascript code online to help me. Heres the code: <script language="javascript"> var state = 'hidden'; function showhide(layer_ref) { if (state == 'visible') { ...

Viewstate Compression Issues [Resolved]

I'm currently fighting with the .NET Viewstate and it is starting to wear me down. Having found that some of the pages in one of our applications is made up of around 80% viewstate I have looked into reducing this where I can. I have looked at (and am happy with) disabling viewstate for controls that do not need it (labels, buttons etc)...

What happens to viewstate in a text/plain page?

Let's say you have a page that produces text/plain output. If you set the ViewState in Page_Load, it doesn't do anything to the output (which makes sense). My question is, does text/plain turn off ViewState processing? What does ASP.NET do to decide when it'll turn things off? ...

Problem getting commandeventargs in command event following re-creationg of controls in postback

I am haveing problems getting the command event args following the second click using the code below. so - when i process a button click, and generate a new button to replace the one that was there i lose the viewstate on the next button click. Any suggestions on what I need to do to get this to work? I cannot significantly change the ...

How to pull PostBack data into a dynamically added UserControl (.NET)?

I have a Panel on my Page: <asp:Panel ID="pnlTest" runat="server" /> Then I dynamically add a TextBox to it on Page_Load: TextBox simpleTextBox = new TextBox(); pnlTest.Controls.Add(simpleTextBox); simpleTextBox.ID = "SimpleTextBox-1"; Is there a way to pull in the information typed in this TextBox without pulling it di...

Erratic Invalid Viewstate issue in a .NET application

I seem to be getting a "invalid viewstate" every now and then in the event viewer for my ASP.NET application. Most of them (95%) seem to be referencing ScriptResource.axd (the application uses the ASP.NET AJAX library). There is no way I can remove the Ajax library either as Ajax is used everywhere.. How can I reduce these errors? I'...

Shouldn’t Bind() pass child control’s values to GridView before Page.PreRender?

hello, For controls such as the GridView, DetailsView, and FormView controls, data-binding expressions are resolved automatically during the control's PreRender event But doesn’t data source control perform updates prior to Page.PreRender event? Meaning, shouldn’t Bind() pass child control’s values to GridView ( so they can be pas...

GridView and Load Postback Data stage

Hello, Q1 A) On a postback, when in the page’s life cycle are GridView’s rows populated with all the values it had before user issued a postback? Thus at what point does GridView already have all the values it displayed on user’s page? I’m assuming this happens the same time it happens with other controls, which is during Load View...

Setting GridView's DataSourceId to "", causes GridView to lose...

Hello, If I bind GridView to SqlDataSource, then the first time page will be created, GridView will display columns retrieved from data source. But if on postback I set GridView.DataSourceID to null or to an empty string protected void Page_Load(object sender, EventArgs e) { ... if (IsPostBack) ...

Why do controls get populated with postback data twice - during LoadPostBack and during...

Hello, Controls are populated with postback data during LoadPostBack data Stage. If dynamic control is not created and added to control tree during OnInit stage, but later, then control won’t get populated with postback data, as evident by the following code, where Label1 will display an empty string: public partial class _Default ...

whats the best way to pass data to user components in asp.net?

its .net 2.0 here, not MVC, and im crap at asp forms :(. So yeah, ive got a page with user controls on it. When i click on something in the page, i want to load the usercontrol based on a parameter from the page. Problem is i cant do it. In my page's FaultTree_Clicked, i get the value, then ive tried a variety of things: I tried exp...