473,796 Members | 2,434 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 2037
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
2126
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
2079
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
2168
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
7505
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
943
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
9680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
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
10228
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...
0
10006
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...
1
7547
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...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.