Disable Viewstate On .net 3.5 Applicatoin ?
Dec 18, 2010Can i disable viewstate on asp.net 3.5 applicatoin because i don't know programming on asp.net mvc?
View 3 RepliesCan i disable viewstate on asp.net 3.5 applicatoin because i don't know programming on asp.net mvc?
View 3 Replies<asp:TextBox ID="TextBox1" runat="server" EnableViewState="false" />
<asp:Button ID="Button1" runat="server" Text="Button" />
I have set the EnableViewState property to false, but when I click on the button the value in the textbox persists after the postback. Why does the value persist?
Completely disabling viewstate
View 6 RepliesIf I disable ViewState at Page level, will it be remembered for GridView inside the page?
View 1 RepliesI have a web page which is using PasswordRecovery control.
But I have a scenario in which I have to disable Viewstate for the whole application.
Now after disabling viewstate when I visit the webpage I have noticed that PasswordRecovery controls is not working (Every times when I submit the default button to go to step 2, the postback occur but not moving to step 2).
I need to know basically what are the use cases will comes for any applicatoin or project.I have project which is done in asp.net mvc control.. My requirement is to wriet the use cases for the entire asp.net mvc application..can any body tell me from where I need to start?and what are the differnt use cases will exists?
View 2 Repliesmy web site i have two databases, ASPNETDB.MDF and a self created one (database.mdf). (The don't contain a lot of data yet)But i need a relationship (foreign key) between a table in ASPNETDB.MDF and a table in database.mdf.So i guess i need to merge both databases first, would you just extend the "ASPNETDB.MDF" with the tables from "database.mdf" ?or better configure "database.mdf" for the asp.net Applicatoin Services and then delete "ASPNETDB.MDF"
View 2 RepliesNow here is the weird thing. First i am running it locally on the built in vs2008 web server.I load my control in fine, do a postback from a linkbutton, locally on my machine it all works fine, no issue.However when it goes onto my host, it falls over with the message:
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.Now i also load controls dynamically and use postbacks and things in the admin area of the site...and that works fine, however my front end just keeps failing? See the code behing below:
[Code]....
I have problem getting values from viewstate in GetTopThemes.
<asp:ObjectDataSource
ID="sourceGetTopThemes"
runat="server"
TypeName="DBConnection"
SelectMethod="GetTopThemes"
EnableViewState="true"></asp:ObjectDataSource>
[Code]....
}
[Code]....
when the page is not Posted back, I saved all values in the viewstate.
I have been getting this error a lot lately with some of my users, and I had a couple of concerns with view state and I have read so many articles but I am still lost..
1. I use masterpage on all the pages and I need viewstate for some of the pages but..
There is a page where a user will fill out the information and then submit this data to a cgi server, and it is where I get most of the Client Disconnected errors, what would happen if I disable viewstate when they click on that button?
Now when a user browses from one page to another, does the view state from the previous page get deleted? If not how would I delete it?
Does the master page have its own viewstate? Would I be able to make sure none of items on my master page are using the viewstate?
I have a shopping cart page (Cart.aspx) that has a button that will (sometimes) post to a third party payment gateway, if payment is necessary. The payment gateway will process the payment and then do a silent post to my website (Order.aspx) so I can update the order status.
Order.aspx always throws an invalid viewstate error, even though viewstate is disabled on the page.
What's happening is that Cart.aspx (which has viewstate enabled) posts to the payment gateway, and the gateway will post it back as part of the silent post. Even though Order.aspx has viewstate disabled and validation disabled, it still tries to validate the __viewstate field it's being given.
I know setting EnableViewState=false will disable the rendering of the __viewstate field, but if another page provides the field, shouldn't it still skip validation? I tried calling ViewState.Clear() on the Page_Init event of Order.aspx, but ViewState is apparently empty. how to get around this? I don't want to disable ViewState on Cart.aspx (in some cases it may be necessary), but I can't figure out how to clear it on Order.aspx.
I have a simple javascipt which enables/disables some checkboxes when another checkbox ticked/unticked. This works fine, however, in some instances when by page is loaded my code behind disables the same check boxes. When this happenes my original check box nolonger seems to have any influence in enableing or disabling - there is no error and all the elements seem to be found by the javascript - it just doesn't enable/disable the checkboxes.
View 5 RepliesI have a problem with disabling the tabcontainer.
The problem is that, if a user haven't selected anything, the whole tabcontainer must be disabled. If I disable the tabcontainer it in de codebind, the tabcontainer grayed out but the user can click the tabs.
I can disable one tab in javascript but how can I disable the whole tabcontainer?
I have added one datalist into view state as:
ViewState["datalist"] = dtlstForm;
and retrieved it as:
DataList lis = (DataList)ViewState["datalist"];
then folowing error comes:
Type 'System.Web.UI.WebControls.DataList' in Assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
I have an aspx page that I want to convert to an HttpHandler, but I'm struggling withewState that's been used in the code behind of the aspx page
View 2 RepliesUpon page reloads I want to retain the values the user had typed in upon hitting submit. I worry about viewstates being cumbersome for pages, both in bandwidth and in time for a page viewer to download the page. I am cheap with my bytes :p
My question is instead of using server controls and such I am having the form on the page do a get to itself and on the aspx putting <input type="text" id="user_email" name="email" value="<%=Request.Form["email"] %>" /> This allows me to not use viewstate. Are there any potential shortcomings to doing things this way? My goal is always for a lighter page and efficiency even if it is more work.
I am using a enum
public enum WatchUsageMode
{
Watch = 1,
EmailPreferences = 2
}
i want to set the property of that enum in my view state in such a way that whenever view state is null return Watch else EmailPreference.how can i get and set the property?
i am new at the ViewState and i am looking to see what values are stored within it. I know how to loop through an array to check for a value but i do not know how to go about doing that for a ViewState("test") property.Let's say i have added "bob, tom, Jim" to a ViewState called ViewState("test"). I would like to be able to see if "tom" was in the ViewState("test"). If not then add it but if it exists already then skip it.
Public strIDArray() As String
Public vsSaver As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
[code]...
If EnableViewStateMAC is set to true, ASP.NET will generate a hashcode for the ViewState data and compare it to the hashcode stored in the posted value. What prevents an attacker from setting the hash based on the altered form values?
View 1 Replieswell what i want to find out is how can i figure out if some change occurd in page when postback , i mean when the first state of the page hahe any changes after postback . I thought maybe somehow to compare viewstaes but i can not find out how can i do that.
View 13 Replieslately I'm using less and less the ASP.NET controls and also turns off the viewstate in almost any page, in my opinion its easier to maintain your pages, you get more control over what happening and most importantly it gives a serious performance boost to large pages (no view state). I'm also using a lot of ajax in my projects (without the script manager / updatecontrol but via javascript) is anyone here working like this? is this bad practice ?
View 18 RepliesThe following message appears in our log: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 controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. alot has been written about this subject. However, I cannot reproduce this behavior, and I only find a couple thousand errors per day in the logs; so it's probably isn't that obvious.
The page in question has an UpdatePanel and loads one of three usercontrols depending on the querystring.Is there any known issue with some clients, or any other possible explanation?
In building custom controls, I've seen two patterns for using the viewstate. One is to use properties to disguise the viewstate access as persistent data.
public bool AllowStuff
{
get
{
return (ViewState[constKeyAllowStuff] != null) ?
(bool)ViewState[constKeyAllowStuff] : false;
}
set { ViewState[constKeyAllowStuff] = value; }
}
The other is to use private member fields and to override the Load/SaveViewState methods on the control and handle it all explicitly:
protected override object SaveViewState()
{
object[] myViewState = new object[2];
myViewState[0] = base.SaveViewState();
myViewState[1] = _allowStuff;
return myViewState;
}
protected override void LoadViewState(object savedState)
{
object[] stateArray = (object[])savedState;
base.LoadViewState(stateArray[0]);
_allowStuff = (bool)stateArray[1];
}
(I cut out a lot of safety checking for clarity, so just ignore that.) Is there are particular advantage to one method over the other? I can't see how they'd differ much performance wise. Version 1 is lazy, so I guess you save a bit if you don't need that particular value during a pass. Version 1 is also more abstract, hides the details better. Version 2 is clearer about when the data is actually valid and ok to read or modify (between the load and save) because it more clearly works within the ASP.NET lifecycle. Version 2 does tend to require more boilerplate code though (a property, a backing private field, and viewstate handling in two places) as opposed to Version 1 which combines all that into one place.
i have a web for and want to 'get' it to another page.. is there anyway to submit it without posting the viewstate and other bits i dont want? or should i be catching the submit button click and redirecting with a querystring i build myself
View 4 RepliesI can tried save some data to ViewState, but i get this Error:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value 'HeRMeSSAAS.BussinesProcess.BussinesServices.CandidateService' of type 'HeRMeSSAAS.BussinesProcess.BussinesServices.CandidateService.'
Code:
private IActionService ActionService
{
get [code]...
How i can store value to ViewState?