Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP

Reply
Thread Tools

HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP

 
 
Bill
Guest
Posts: n/a
 
      03-01-2004
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).




 
Reply With Quote
 
 
 
 
SB
Guest
Posts: n/a
 
      03-01-2004
Of course you can!
Step1: get your dataset
Step2: Assign the datasource property to the dataset.
You can even consider a loop to do this
for (int i=0;i<50;i++){
//assume your ddl are named ddl1,ddl2, ...
string ddlID="ddl"+i.ToString();
DropDownList ddl=(DropDownList)this.Controls[ddlID];
ddl.DataSource=myDataSet;
ddl.DataBind();
}
"Bill" <> wrote in message
news:e%23Soz%234$...
> 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).
>
>
>
>



 
Reply With Quote
 
 
 
 
Bill
Guest
Posts: n/a
 
      03-02-2004
Thanks sb ... this helped allot.

BUT, this has caused me to rethink my approach...

Essentially, what I have here is 50 booth table row entrees (boot ID,
location, assigned company).

What I really would like here is the function of an "editable" datagrid
control (with dropdown list boxes of course) AND a "none grid" like display
(freely displayed/placed over a floor & booth diagram).

Is there anyway I can easily enjoy the best of both worlds? The efficiency
of handling datasets using a datagrid kind of control and the flexibility of
data display unrestricted to a column and row format.


"SB" <> wrote in message
news:ug$DPS8$...
> Of course you can!
> Step1: get your dataset
> Step2: Assign the datasource property to the dataset.
> You can even consider a loop to do this
> for (int i=0;i<50;i++){
> //assume your ddl are named ddl1,ddl2, ...
> string ddlID="ddl"+i.ToString();
> DropDownList ddl=(DropDownList)this.Controls[ddlID];
> ddl.DataSource=myDataSet;
> ddl.DataBind();
> }
> "Bill" <> wrote in message
> news:e%23Soz%234$...
> > 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).
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Passing Bound Object value to another Bound Object Phillip Vong ASP .Net 0 07-27-2006 10:54 PM
Get object from DropDownList bound to object Grant Merwitz ASP .Net 1 07-06-2006 02:25 AM
HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP Bill ASP .Net Web Controls 1 03-02-2004 02:28 PM
HOW TO: Create a single DataSet bound object used by 50 DropDownList box controls in the same web form. CSHARP Bill ASP .Net 3 03-01-2004 05:31 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57