Drop Down Box Question

Results 1 to 2 of 2

Thread: Drop Down Box Question

  1. #1
    Join Date
    Dec 1969

    Default Drop Down Box Question

    What I want to do is to to obtain criteria from the user from the previous page and from this criteria and from this the criteria will determine how many dropdown boxes are needed. So if in the criteria I picked animal and animal in the database contains cat, dog, and horse; I want the next page to then generate 3 drop down boxes since there is 3 items in the database. In the drop down boxes I want each drop down boxes to contain cat, dog, and horse, the only difference between is the item selected in the dropdown box. So one will be cat, one will be dog, and the other will be horse. So if there is 4 items in my database i need 4 dropdown boxes. I can&#039;t use visibility false on the drop down boxes, because i have to deal with over 400 items in my database.<BR><BR>Thx for your help and time.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Drop Down Box Question

    *<BR><BR>for (int i = 0; i &#060; TotalResultsFromDB; i++ ) {<BR><BR>DropDownList dd = new DropDownList();<BR>dd.ID = "dd_" + i.ToString();<BR>this.Page.Controls.Add(dd);<BR><B R>dd.FindByValue(myDataSource.Tables[0].Rows[x]["MyField"]).Selected = true;<BR><BR>}<BR><BR>for (int x = 0; x &#060; this.Page.Controls; x++ ) {<BR><BR> DropDownList dd = this.Page.FindControl("dd_" + x.ToString()) as DropDownList;<BR><BR>dd.DataSoruce = myDataSource;<BR>dd.DataBind();<BR><BR>}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts