473,811 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
EnableViewState Mac 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 2038
In ASP.NET v1.x much of the behavior of controls (so things like SelectedIndexCh ange
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 EnableViewState Mac 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
3234
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
312
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 : System.Web.UI.Page { protected System.Web.UI.WebControls.Button Button2;
3
2129
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 2002, .Net Framework 1.0 SP2. I create a new project, and add a new web form to the project. On the page properties, I set EnableViewState to False and verify that the @ Page directive has "enableViewState=false" in it. I then add a TextBox...
1
456
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 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...
0
2080
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 flush the XML file content on page load. I tried parentnode.removeall () but no use.. (1) how to clean/delete the XML file nodes on page load for using as DATA SOURCE which again i'm binding to Grid view..?? (2) and also on page refresh my gird...
11
2170
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 person to the list view, well this works fine up to about 1,000 people then it start's to get really show putting the people in (a lot of process time used up)... does anyone know of any optimizations i could do to make this processess work a lot...
3
1722
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 and get some data from a dataset and then from it's contents build the page At this point the page is rendered and 2 rows are displayed. There is an Add button that a user can click to add another row to the table. This works fine and the row...
12
7506
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 it to reset info in a combo box. Below is some sample code for my view interface and the presenter: public interface IDevToolView
4
944
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, which is ugly in its own right) When the form first loads up, I populate a drop down list, set the selected item to the first item, return my data for the selected item in the drop down list, then build my table. I am creating a few hidden controls...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10386
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.