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

Populate controls once

How do I make sure that when an execution is taken back to the server
controls like combos are not populated again?

Thanks
Nov 18 '05 #1
2 930
If you populate your controls in the Page_Load event, you can wrap the code that populates the controls in an

If Not Page.isPostBack
....
End If

block. This will only execute the code (within the block) once; when the page loads initially. You can ensure that the data remains in the controls by setting the controls viewstate property to true.

hope this helps,
John

"Mark Goldin" wrote:
How do I make sure that when an execution is taken back to the server
controls like combos are not populated again?

Thanks

Nov 18 '05 #2
Thanks, that worked.

"John Sivilla" <Jo*********@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
If you populate your controls in the Page_Load event, you can wrap the code that populates the controls in an
If Not Page.isPostBack
...
End If

block. This will only execute the code (within the block) once; when the page loads initially. You can ensure that the data remains in the controls
by setting the controls viewstate property to true.
hope this helps,
John

"Mark Goldin" wrote:
How do I make sure that when an execution is taken back to the server
controls like combos are not populated again?

Thanks

Nov 18 '05 #3

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

Similar topics

1
by: John | last post by:
I have two fields on a form. Once called School, the second called SchoolZip I want the users to be able to go to the ComboBox field called School, select the school they want, and have it auto...
3
by: Yuriy | last post by:
Hello! I need populate PlaceHolder control dynamicaly and some of the control should be server controls and regular html controls. I try to do it but could not found methods to add javascript to...
3
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
2
by: MattB | last post by:
I've got a web form (asp.net 1.1, vb.net) that has controls for a user to enter their height and weight in either English or Metric units. I'd like to be able to populate the metric control when...
5
by: John A Grandy | last post by:
is it possible to write a vb.net code (intended to run on the client-side) that would invoke an instance of IE, have it download a page from a certain URL, and then pre-populate some of the...
1
by: *no spam* | last post by:
I've figured out how to enumerate through all the controls in a form (code below) However, how would I populate the TreeView with control names in correct hierarchial order? Private Sub...
1
by: rajarameshvarma | last post by:
Hi, I have two user controls in an asp.net webpage each contains a DropDownList. Depending on the selection of the drop down in one user control i need to populate data in the other drop down...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
3
by: sweetpotatop | last post by:
Hi, I am try to populate a number of dropdownlist with the same item, for i = 1 to 5 dd = me.controls("dd" + Cstr(i)) itm = new listiem itm.text ="abc" itm.value ="aaa"
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.