ViewState Used To Save A Value In Browser?
Mar 8, 2011I set ASP.Net ViewState to off for a text box control, but the value for the name of the user is still there. Why is this so?
View 3 RepliesI set ASP.Net ViewState to off for a text box control, but the value for the name of the user is still there. Why is this so?
View 3 RepliesI have Dim a(15) as integer i wont to save this array in Viewstate .
View 2 RepliesI have searched the web for the answer and saw that mostly variables are saved in viewstate on page.prerender event. Then the value of the variable is set back in page load event.However, when I save a variable in viewstate on prerender or load events, how can viewstate store the value of the variable after it is changed dynamically on codebehind?
Let's say, after page is loaded, user clicked a button which changes the value of the variable in its onClick event. Then the postback event raised since the button was clicked. According to me, the new value should have been lost and cannot be saved in the viewstate if the variable is saved in the viewstate only in prerender event. Because on postback the prerender event wont fire and the value cannot be saved.
Shouldn't I save the variable in the viewstate just before the postback event rises?? If so, how can viewstate store the new value of the variable if the viewstate is saved in prerender event?
At my user-control I populate listbox with collection and want save data in viewstatecontrolstate for further autopostback using.
protected void btFind_Click(object sender, EventArgs e)
{
var accounts = new AccountWrapper[2];
accounts[0] = new AccountWrapper { Id = 1, Name = "1" }; [code]...
ListBox is populated at button click. When I save accounts to ViewState listBox is empty, when not it displays collection good.
i bind a DataTable to a gridview.i want to use the DataTable in some postback event, and ii want to use viewstate.
does gridview save data in viewstate? if no what is the best way to do this.
(full story :i have a custom gridview derived from standard asp.net gridview, and i put a button in header to export data to excel, i want to use data saved in viewstate to export to excel)
I am looking for an event firing before a DropdownList auto-postback to save Listbox items (populated with JS) in the ViewState.I tried the OnSelectedIndexChanged event but it's fired too late.
View 5 RepliesI have created a custom control that extends the class ImageButton, the thing is that I now also want to save this control to a viewstate.
View 4 Replieshow save int array in viewstate?
View 4 RepliesI have a composite control that has a couple of private fields that reference values in the cache and these private fields are called during the constructor method. Since a string key is used to identify the value in the cache, I must have a way of storing that string key in such a way that it is available at the time the control is instantiated, and I have to be able to reference it on postbacks without it changing.
In addition, this key is generated the first time the control is loaded, but it should not be changed again after that first time.
How can I accomplish this?
I have already tried saving it to viewstate, but that doesn't work because viewstate is not yet available at the time the control is instantiated.
I have tried using a private field and then checking against Page.IsPostback in the constructor and if it isn't postback, I assign a value to the private field, but on subsequent postbacks it looses it's value, and I can't reassign it in the Page.IsPostBack again because it is an autogenerated GUID.
When I try to save an object reference in a view state it tries to save the object content using serialisation. to save the object reference only to apply to this object instance after postback?
View 5 Replieshow to save the CheckBoxList values into the viewstate
for e.g.i've a CheckBoxList with 4 ListItems,
if I check 1 & 3 items, then I close the page
if I re-open the page, items 1 & 3 must be checked.
I am designing a site with that requires users to login in to access info. How do I save the user name and password in viewstate or session. so I can use it in other pages later.
View 2 RepliesI have an application where ViewState is set to "true". In some pages, I can see the viewstate value at the top of the page (just below the addressbar). But this only happens in Safari browser. And when this is shown, clicking on any button in that page, it is going to some error page. In Mozilla, IE7/8, Opera it is running properly !
View 3 RepliesViewState["Index"] = reader[0].ToString();
Using sqlDataAdapter, I wanna save one column to view state like this.
how can i add dynamic control (like textbox) on asp.net page at runtime and maintain the values of the control (viewstate of control ) on client browser refresh or roundtrip?
View 3 RepliesI need some help in the technical approach with the following scenario:-
1) A dropdownlist with some options. It has a postback action on the selectedIndexChange server side event handler. For example, lets say it contains language options such as english, french etc.
2) Repeater with a label and the textbox control. For example label is Emp Name and textbox is containing the Emp Designation. We have to save emp designation in the various languages.
3) Every time i pick something from the dropdown, i have to flip the textbox control and fill the form. Now i want to save the given data of the texbox in the viewstate. So that every time, the user changes the dropdown selection, he can see the repeater data corresponding to the dropdown selection.
4) I guess some kind of relationship between the dropdown option and the repeater data is needed. But how can we make this thing work.
Now which is the best technique to save the data on the server side? I have to keep it in the viewstate.
How to know the FileName AjaxFileUpload in the event Click of a Button without going through earnest for this is what I found that is to say that the FileName is only in the event Designed AjaxFileUpload1_UploadComplete.
protected void InsertButton_Click(object sender, EventArgs e) {
lblMSG.Text = ViewState["filename"].ToString();
}
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) {
ViewState["filename"] = e.FileName;
}
protected void AjaxFileUpload1_UploadComplete (object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) {
string filePath = "~ / upload /" + e.FileName;
AjaxFileUpload1.SaveAs (filePath);
}
i am facing the following problem while saving the viewstate on the server side using the savepagestatetopersistencemedium, but this is not working for the pages which contains update panel.
View 2 RepliesI have changed the look and feel of the grid by modifying the cols, rows in the gridview. I need to save this in the gridview viewsate, so that it load the modified look and feel next time it loads from the viewsate.
View 3 RepliesI'm streaming PDFs to the browser, and it works fine. The problem is when someone clicks the save button. On the same server, we have a "Live" and a "test" site. They are identical, and I've verified that all code is identical. However I'm seeing different dialog boxes when the user clicks "Save"
Test site:
- dialog box: "Save A Copy"
- file name: "Document.pdf"
- file type: Adobe PDF
Live site:
- dialog box: "Save As..."
- file name: "Document.aspx"
- file type: Adobe PDF
To make things even more "fun" I've noticed this behavior ONLY with IE8. With Firefox or Chrome clicking save - regardless of which site (test or live) opens the "Save a Copy" dialog box which allows the users to save the file as a PDF instead of a .aspx file.
I want to save log out time when user close the Browser without clicking log out button using asp.net with C# and SQL server 2005.
kindly let me know the way as well as code..
I am thinking about opening a PDF file with some editable fileds in the browser , by which i can modify the PDF file / fill information etc and then save that PDF FORM
View 7 RepliesI have a mail list where i can select many mails and download (with/without opening the mail). During the download process i update the mail status(download/open) and show the content in pdf. In normal browser dialog opens where user can save open or cancel options exits. But if the user cancel then the update process done on the mail should not happen. so i think about doing the update process if the user clicks open or save but how can i identity that client control (i think it depend on the browser)
The issue is present if i download and unopened mail and click cancel button in the dialog box the pdf creation code i have done is in this link
[URL]
which i used to open that dialog in browser to save pdf
I have a requirement to disable save as and print options of file menu of the browser in which my portal opens.For this i have used javascript code which clears the clipboard text.Because of this when my pplication is opened then copy paste wont work on the system.Iam calling this method on load of a startup page and afer clearing the clipboard text iam opening my home page through javascript with no menu bar just like a modal popup iam trying ot open.This is working fine for some browsers but IE7 and firefox users are unable to load the applicatio because of this javascript function.Can anyone suggest me how to overcome this or how to disable save as and print option.My final aim is user shouldnt be able to save or print my application data...
View 5 RepliesIs that a way to edit excel file on browser and then save it on server?
View 5 Replies