473,324 Members | 2,193 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,324 software developers and data experts.

view state and data binding

Hi.
I am developing composite web control which contains a ListBox. I'd like
to minimize the amount of data transfered in view state to the client and
back, so I set to false EnableViewState property of the ListBox and
populated it by DataBind method. But in such scenario ListBox's
SelectedIndex property always returns -1 on postbacks.
Could you please answer is it possible to know what item was selected by
user in ListBox with view state disabled? What method or event should I
handle in the page's (or control's) life cycle?
I thought such properties as what item was selected in a ListBox are not
retrieved from view state. Browser can not change VIEWSTATE hidden variable,
it (VIEWSTATE variable) can even be protected from tampering by setting
EnableViewStateMac property to true. So browser should post back such
properties in some other way. Am I not right?

Best regards.
Sergey Krutous.
Nov 19 '05 #1
1 2008
In ASP.NET v1.x much of the behavior of controls (so things like SelectedIndexChange
events) relies upon ViewState. This is fixed in ASP.NET 2.0 with something
called ControlState which is in essence a section of ViewState that you can't
disable. The portion of ViewState you can diable only contains the data (not
the behavior) of the control.

So for now, you must enable ViewState.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi.
I am developing composite web control which contains a ListBox.
I'd like
to minimize the amount of data transfered in view state to the client
and
back, so I set to false EnableViewState property of the ListBox and
populated it by DataBind method. But in such scenario ListBox's
SelectedIndex property always returns -1 on postbacks.
Could you please answer is it possible to know what item was
selected by
user in ListBox with view state disabled? What method or event should
I
handle in the page's (or control's) life cycle?
I thought such properties as what item was selected in a ListBox
are not
retrieved from view state. Browser can not change VIEWSTATE hidden
variable,
it (VIEWSTATE variable) can even be protected from tampering by
setting EnableViewStateMac property to true. So browser should post
back such properties in some other way. Am I not right?

Best regards.
Sergey Krutous.


Nov 19 '05 #2

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

Similar topics

4
by: Maheshkumar.R | last post by:
Hi groups, How to get a particular selected row ID from a grid view control where i have placed imagebutton. On click event how i can get the ROW ID ? -- Mähésh Kumär. R
0
by: Eran Amitai | last post by:
I have the simplest web page (using code-behind): <body> <%# MyText %> two buttons - button1 and button2 </body> My code-behind web page is very simple too: public class WebForm3 :...
3
by: Philip Tripp | last post by:
I've read numerous sources stating that view state can be disabled per control, and per page, but can't seem to keep web form controls from remembering their state on a postback. I'm using VS.Net...
1
by: Sergey Krutous | last post by:
Hi. I am developing composite web control which contains a ListBox. I'd like to minimize the amount of data transfered in view state to the client and back, so I set to false EnableViewState...
0
by: ¿ Mahesh Kumar | last post by:
I have created a XML file as datasource which i 'm binding to a grid view control. During runtime I'm capturing items in XML file and displaying in a GRID VIEW control. but i want to remove or...
11
by: Brian Henry | last post by:
Well here is the problem, I have a data set with about 9,000 to 20,000 people in it in the data table "people"... I am then reading it into a list view one at a time row by row... adding each...
3
by: gaDev | last post by:
1) I build a Html Table dynamically (Header Row, and then 2 rows with data All 2 rows have 2 cells: cell(0) contains a delete button (ASP Button), cell(1) contains a HTML Text box 2) On Form Load...
12
by: Doug | last post by:
Hi, I learned a little about the model view presenter pattern at a conference this last week and am experimenting with it. It's working pretty well but I have a question. I am trying to use...
4
by: Jeremy | last post by:
I am writing a complex data editor, and I am building a table with other controls in it on the fly. ( I know, not for the faint of heart. My other options are a quadruply nested data repeater,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.