Re: HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP
From: Pete Davis (pdavis68_at_hotmail.com)
Date: 03/01/04
- Next message: Jon Skeet [C# MVP]: "Re: " i = 10 " gives " i == 6 " ?!?!Q!?="
- Previous message: Dmitriy Lapshin [C# / .NET MVP]: "Re: Datagrid Custom GridTableStyle??"
- In reply to: Bill: "HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP"
- Next in thread: Bill: "Re: HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP"
- Reply: Bill: "Re: HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 01 Mar 2004 13:13:59 GMT
If all of the controls are on the same form, and assuming they have a
similar name that's different from other drop down lists on the form
(assuming their are others), you can iterate through all the controls on the
form, and for all combo boxes that match your name criteria, you could bind
the dataset to them. Something like:
DataSet ds = GetMyDataSet();
foreach(Control ctrl in this.Controls)
{
if (ctrl.GetType() == typeof(DropDownList) && ctrl.Name.Substring(1, 4) ==
"seat")
{
((DropDownList) ctrl).DataSource = ds;
((DropDownList) ctrl).DataBind();
}
}
-- http://www.petedavis.net "Bill" <bcross@mcleodusa.net> wrote in message news:eC59j74$DHA.1700@TK2MSFTNGP12.phx.gbl... > I have a seating chart web form that has over 50 entry field controls > (tables/booths) where I use a DropDownList box to select a single company > name from a single large list of organizations (200 plus conference > attendees). All web form datavalues will be one of the same 200 > organizations in this list. I would like to avoid creating 50 separate exact > copies of the same DataSet object. Can you help? > > Q. Exactly how do I use the same DataSet object in all 50 DropDownList boxes > on my web form with out creating it 49 more times? Isn't there a simple > way of "referring to" or "cloning" or binding each of the 50 web controls to > the same (single dataset created by a single db query). > >
- Next message: Jon Skeet [C# MVP]: "Re: " i = 10 " gives " i == 6 " ?!?!Q!?="
- Previous message: Dmitriy Lapshin [C# / .NET MVP]: "Re: Datagrid Custom GridTableStyle??"
- In reply to: Bill: "HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP"
- Next in thread: Bill: "Re: HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP"
- Reply: Bill: "Re: HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|