473,403 Members | 2,270 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,403 software developers and data experts.

Help, Populating dropdowns via subroutine

I'd like to populate four dropdowns using code behind. Each dropdown contains the same list. How can I populate them using a subroutine. Something like:

InitializeDropDownList(ddlQuadrant1) 'Where ddlQuadrant1 is the first dropdown
InitializeDropDownList(ddlQuadrant2) 'Where ddlQuadrant2 is the second dropdown
InitializeDropDownList(ddlQuadrant3) 'Where ddlQuadrant3 is the third dropdown
InitializeDropDownList(ddlQuadrant4) 'Where ddlQuadrant4 is the fourth dropdown
Which calls something like this:

Private Sub InitializeDropDownList(ByVal ctlDropDownList As DropDownList)

ctlDropDownList.Items.Insert("", "")
ctlDropDownList.Items.Insert("Application/Credit", "Application/Credit")
ctlDropDownList.Items.Insert("Note Features", "Note Features")
ctlDropDownList.Items.Insert("Regency", "Regency")
ctlDropDownList.Items.Insert("ARM Info", "ARM Info")
ctlDropDownList.Items.Insert("Pay History", "Pay History")
ctlDropDownList.Items.Insert("Property", "Property")
ctlDropDownList.Items.Insert("Valuation Comments", "Valuation Comments")
ctlDropDownList.Items.Insert("Diligence Comments", "Diligence Comments")
ctlDropDownList.Items.Insert("Compliance", "Compliance")

End Sub

Nov 19 '05 #1
1 1172
Nevermind, I figured out my issue, the first parameter in the "Items.Insert" needs a sequence number (e.g. 0 for first item, 1 for second item, and so on)
"Paul D. Fox" <pd*****@rcn.com> wrote in message news:up**************@TK2MSFTNGP11.phx.gbl...
I'd like to populate four dropdowns using code behind. Each dropdown contains the same list. How can I populate them using a subroutine. Something like:

InitializeDropDownList(ddlQuadrant1) 'Where ddlQuadrant1 is the first dropdown
InitializeDropDownList(ddlQuadrant2) 'Where ddlQuadrant2 is the second dropdown
InitializeDropDownList(ddlQuadrant3) 'Where ddlQuadrant3 is the third dropdown
InitializeDropDownList(ddlQuadrant4) 'Where ddlQuadrant4 is the fourth dropdown
Which calls something like this:

Private Sub InitializeDropDownList(ByVal ctlDropDownList As DropDownList)

ctlDropDownList.Items.Insert("", "")
ctlDropDownList.Items.Insert("Application/Credit", "Application/Credit")
ctlDropDownList.Items.Insert("Note Features", "Note Features")
ctlDropDownList.Items.Insert("Regency", "Regency")
ctlDropDownList.Items.Insert("ARM Info", "ARM Info")
ctlDropDownList.Items.Insert("Pay History", "Pay History")
ctlDropDownList.Items.Insert("Property", "Property")
ctlDropDownList.Items.Insert("Valuation Comments", "Valuation Comments")
ctlDropDownList.Items.Insert("Diligence Comments", "Diligence Comments")
ctlDropDownList.Items.Insert("Compliance", "Compliance")

End Sub

Nov 19 '05 #2

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

Similar topics

3
by: Damon | last post by:
I am working on a site in which I would like to have two dropdowns that will allow a user to navigate through the administrative pages of the site. The first would allow the user to choose the...
3
by: Eric | last post by:
I had a windows form project that had a functions module that could control objects on the referenced main form. How would I do the same with a web project using a web form? See my windows form...
7
by: nicholas | last post by:
Hello, Got a kind of e-commerce site. There are products with product options, such as color, size, etc All are defined a table: tbl_products: the table with the products. tbl_options: the...
1
by: Andy | last post by:
What I want to do is to populate multiple dropdowns when editing. Presumably... a) I should use a DataReader so that I can get each ResultSet for each dropdown control, and that should cut down...
5
by: dsmasters | last post by:
Hey there, I have been piecing this menu system together from a couple of different sources and can almost see the end the of the tunnel. This is based on the Suckerfish Dropdowns which then...
3
by: Simon Harvey | last post by:
Hi everyone, I keep getting a problem with dropdownlist controls. It sounds really stupid, but my app is screwed as long as this keeps happening. It seems to spontaneously happen and then I...
2
by: Anup | last post by:
In my application there are many inter-dependent dropdowns. ie:- when user select value form dropdown1 according to that a query is fired and the data is populated in dropdown2 by applying the...
0
by: yeltsin27 | last post by:
I need some advice on handling dynamically added controls in a GridView. My app takes an uploaded CSV file containing addresses, converts it to a DataTable, databinds the DataTable to a...
2
by: Shikha1234 | last post by:
Hi, I have two dropdowns. I want that the DDL2 gets populated based on the values in DDL1. How can I achieve that. This is the way I am populating DDL1 string cmd = "Select *...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...
0
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,...
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
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,...
0
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...

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.