473,383 Members | 1,748 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,383 software developers and data experts.

Viewstate versus performance

If I want to create a ListBox filled by a database query, it is not
recommended to enable the viewstate of the form,
because it does not make sense to reconstruct the whole and costs
performance.
But what if I want to react on the onChange event, I do have to set
autoRepost to true to get my selectedItem.
It seems I need the viewstate to retrieve my selection.

What is the best practice to do this:
- fill list by database query
- react on change event at the client site or with minimum overhead on
server
Nov 17 '05 #1
1 1477
You don't necessarily need ViewState to do this. Assuming
when binding the ListBox you are using a column from the
DB that identifies a record, to populate the Value
property of the list items you could use Request.Form
("ListBoxName") to retrieve the selected item(s).

-----Original Message-----
If I want to create a ListBox filled by a database query, it is notrecommended to enable the viewstate of the form,
because it does not make sense to reconstruct the whole and costsperformance.
But what if I want to react on the onChange event, I do have to setautoRepost to true to get my selectedItem.
It seems I need the viewstate to retrieve my selection.

What is the best practice to do this:
- fill list by database query
- react on change event at the client site or with minimum overhead onserver
.

Nov 17 '05 #2

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

Similar topics

0
by: Bigal | last post by:
If I want to create a ListBox filled by a database query, it is not recommended to enable the viewstate of the form, because it does not make sense to reconstruct the whole and costs performance....
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? ...
3
by: Brian Henry | last post by:
for my <input type="hidden" name="__VIEWSTATE" on output forms... the value of the __VIEWSTATE is over 10 pages long! it makes forms load so slow, why is it that long and what can i do about it?!...
4
by: rom | last post by:
I saw a "strange" code line somewhere on the web. it looks like: ViewState(myKeyWord) = myValue what am I missing here? what exactly is the viewstate ?is it different from session?
4
by: Ben Fidge | last post by:
Does anyone know any tricks for reducing the size of the ViewState? Kind regards Ben
9
by: Mark Broadbent | last post by:
Been a while since I've touched asp.net but one thing that always seems to fustrate me is the loss of state on variable declarations. Is there anyway (i.e. assigning an attribute etc) to instruct...
7
by: Ben Amada | last post by:
I've created a class that I need to store in ViewState. However when I try to store it in ViewState, I get the following error: "The type 'solution.pe2' must be marked as Serializable or have a...
4
by: anandsoni | last post by:
I have been working with a project where I need to deal with lot of data. This data includes 10 thousands of records in the data grid. There are thousand of users connected to the application, this...
9
by: =?Utf-8?B?TUNN?= | last post by:
I'm sure the answer to my question varies depending on the situation, but I am looking for a general "best practice". If I have an asp.net application and I load certain data from a database,...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.