473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

disabling viewstate on datagrid

Hi,
I am experimenting with different viewstate management ideas for large
datagrids, and found a microsoft suggestion to turn it off, and only
store relevant information by manually accessing viewstate. as per some
helpful suggestins in MSDN "Common DataGrid Mistakes"
http://msdn.microsoft.com/library/de...idmistakes.asp

they suggest disabling datagrid viewstate and adding selective
information to it i.e. ViewState["editindex"] = this.EditItemIndex etc.

the problem i encountered is, when i set EnableViewState=false, nothing
gets saved there, even though i explicitly save / load viewstate
variables.

Any advice in having it disabled but still using it ?

Nov 19 '05 #1
6 2538
Where do you specify EnableViewState=false? For the whole page in the <%@
Page...> directive? You should do it only for the grid and other components
you want the ViewState to be off.

Eliyahu

"sonic" <so*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,
I am experimenting with different viewstate management ideas for large
datagrids, and found a microsoft suggestion to turn it off, and only
store relevant information by manually accessing viewstate. as per some
helpful suggestins in MSDN "Common DataGrid Mistakes"
http://msdn.microsoft.com/library/de...idmistakes.asp
they suggest disabling datagrid viewstate and adding selective
information to it i.e. ViewState["editindex"] = this.EditItemIndex etc.

the problem i encountered is, when i set EnableViewState=false, nothing
gets saved there, even though i explicitly save / load viewstate
variables.

Any advice in having it disabled but still using it ?

Nov 19 '05 #2
disabling it in datagrid as mentioned above

Nov 19 '05 #3
I have the same problem. When I disable datagrid viewstate, it skips the
datagrid1__SelectedIndexChanged routine entirely.

George

"Eliyahu Goldin" wrote:
Where do you specify EnableViewState=false? For the whole page in the <%@
Page...> directive? You should do it only for the grid and other components
you want the ViewState to be off.

Eliyahu

"sonic" <so*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,
I am experimenting with different viewstate management ideas for large
datagrids, and found a microsoft suggestion to turn it off, and only
store relevant information by manually accessing viewstate. as per some
helpful suggestins in MSDN "Common DataGrid Mistakes"

http://msdn.microsoft.com/library/de...idmistakes.asp

they suggest disabling datagrid viewstate and adding selective
information to it i.e. ViewState["editindex"] = this.EditItemIndex etc.

the problem i encountered is, when i set EnableViewState=false, nothing
gets saved there, even though i explicitly save / load viewstate
variables.

Any advice in having it disabled but still using it ?


Nov 19 '05 #4

"George" <Ge****@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
I have the same problem. When I disable datagrid viewstate, it skips the
datagrid1__SelectedIndexChanged routine entirely.

George

"Eliyahu Goldin" wrote:
Where do you specify EnableViewState=false? For the whole page in the <%@
Page...> directive? You should do it only for the grid and other
components
you want the ViewState to be off.

Eliyahu

"sonic" <so*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
> Hi,
> I am experimenting with different viewstate management ideas for large
> datagrids, and found a microsoft suggestion to turn it off, and only
> store relevant information by manually accessing viewstate. as per some
> helpful suggestins in MSDN "Common DataGrid Mistakes"
>

http://msdn.microsoft.com/library/de...idmistakes.asp
>
> they suggest disabling datagrid viewstate and adding selective
> information to it i.e. ViewState["editindex"] = this.EditItemIndex etc.
>
> the problem i encountered is, when i set EnableViewState=false, nothing
> gets saved there, even though i explicitly save / load viewstate
> variables.
>
> Any advice in having it disabled but still using it ?
>


Try reloading the datagrid on page_init or page_load even during postback.
Mike
Nov 19 '05 #5
Thanks vMike. Probably that's the only way to databind the datagrid
everytime. But how do I know what is the new page selection, or the sort
column, if I databind in the Page_Load?

George

"vMike" wrote:

"George" <Ge****@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
I have the same problem. When I disable datagrid viewstate, it skips the
datagrid1__SelectedIndexChanged routine entirely.

George

"Eliyahu Goldin" wrote:
Where do you specify EnableViewState=false? For the whole page in the <%@
Page...> directive? You should do it only for the grid and other
components
you want the ViewState to be off.

Eliyahu

"sonic" <so*******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
> Hi,
> I am experimenting with different viewstate management ideas for large
> datagrids, and found a microsoft suggestion to turn it off, and only
> store relevant information by manually accessing viewstate. as per some
> helpful suggestins in MSDN "Common DataGrid Mistakes"
>
http://msdn.microsoft.com/library/de...idmistakes.asp
>
> they suggest disabling datagrid viewstate and adding selective
> information to it i.e. ViewState["editindex"] = this.EditItemIndex etc.
>
> the problem i encountered is, when i set EnableViewState=false, nothing
> gets saved there, even though i explicitly save / load viewstate
> variables.
>
> Any advice in having it disabled but still using it ?
>

Try reloading the datagrid on page_init or page_load even during postback.
Mike

Nov 19 '05 #6

"George" <Ge****@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Thanks vMike. Probably that's the only way to databind the datagrid
everytime. But how do I know what is the new page selection, or the sort
column, if I databind in the Page_Load?

George

"vMike" wrote:

"George" <Ge****@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
I have the same problem. When I disable datagrid viewstate, it skips the datagrid1__SelectedIndexChanged routine entirely.

George

"Eliyahu Goldin" wrote:

> Where do you specify EnableViewState=false? For the whole page in the <%@> Page...> directive? You should do it only for the grid and other
> components
> you want the ViewState to be off.
>
> Eliyahu
>
> "sonic" <so*******@gmail.com> wrote in message
> news:11**********************@g14g2000cwa.googlegr oups.com...
> > Hi,
> > I am experimenting with different viewstate management ideas for large> > datagrids, and found a microsoft suggestion to turn it off, and only> > store relevant information by manually accessing viewstate. as per some> > helpful suggestins in MSDN "Common DataGrid Mistakes"
> >
> http://msdn.microsoft.com/library/de...idmistakes.asp> >
> > they suggest disabling datagrid viewstate and adding selective
> > information to it i.e. ViewState["editindex"] = this.EditItemIndex etc.> >
> > the problem i encountered is, when i set EnableViewState=false, nothing> > gets saved there, even though i explicitly save / load viewstate
> > variables.
> >
> > Any advice in having it disabled but still using it ?
> >
>
>
>

Try reloading the datagrid on page_init or page_load even during postback. Mike

In general, if the datagrid is user specific you may need to maintain
viewstate or it will go back to its original state. The only other choice is
to maintain some hidden fields or other smaller items in viewstate that will
enable you to recreate the datagrid in the state that the user had at the
time of postback. IMHO viewstate is used to maintain the state of controls
that are specific to one user as opposed to any user.
Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
2
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
1
by: Sky | last post by:
Although I've been using C# for the last month or so, and accepting out of blind faith the ViewState, I do have some nagging questions about it... can you help verify the following statements? ...
1
by: Dave Bartlett | last post by:
I've been wondering for a while if I can safely turn off viewstate on a datagrid. I read the following article:...
2
by: Dave | last post by:
Hi, When binding a dataset to a DataGrid and paging 10 records at a time, is the entire dataset still encoded and sent to viewstate as well OR just the current page and what's visible to the...
2
by: Steve Pierce | last post by:
I am having some issues with a runtime dropdownlist in a datagrid. The issue is that I cannot get ViewState to fill the selected index of a runtime dropdown properly on postback. I do not want to...
1
by: Graham | last post by:
I have created a server control that reads data from an xml file and renders either a datagrid of entries from a database or group of form controls to allow editing of an individual entry from the...
12
by: TB | last post by:
Hi All: I am trying to create a variation on the standard datagrid, whereby the datagrid is only shown after pressing some buttons. This reason for this is that I would like to use the same...
6
by: Frank | last post by:
Can someone please tell me when the ViewState is loaded? My understanding, based on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconControlExecutionLifecycle.asp...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.