473,405 Members | 2,185 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,405 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 2014
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.