Dynamic DropDownList ->Please Help!

Results 1 to 2 of 2

Thread: Dynamic DropDownList ->Please Help!

  1. #1
    Join Date
    Dec 1969

    Default Dynamic DropDownList ->Please Help!

    Ok...I have run out of ideas at the near end of the day and have gotten frustrated. Does anyone know...how to create dropdownlists dynamically...what I want to do is query the user as to how many entry&#039;s he/she wants to make...and then create dropdown boxes for each of those entrys....I am pulling the data from my database...and have been trying this: <BR>//Code Area <BR> DropDownList myDDL = new DropDownList(); <BR> string connectionStr = @"server=servername;uid=dumbuser;pwd=drowssap;data base=biglist"; <BR><BR> string queryStr = "SELECT Fields FROM myTable"; <BR><BR> <BR> SqlConnection connectObj = new SqlConnection(connectionStr); <BR> SqlCommand commandObj = new SqlCommand(queryStr,connectObj); <BR><BR><BR> <BR> connectObj.Open(); <BR> <BR> myDDL.DataSource = commandObj.ExecuteReader(); <BR> myDDL.DataBind(); <BR> connectObj.Close(); <BR> Dynamicddl.Controls.Add(myDDL); <BR> <BR><BR>and in the html page: <BR>&#060;form runat="server"&#062; <BR>Please Enter your information: All Fields are required! <BR><BR><BR> &#060;asp:PlaceHolder runat="server" id="Dynamicddl" /&#062; &#060;asp:Button Text="Send" OnCLick="InsertData" runat="server" /&#062; <BR><BR><BR>I am getting a Dropdownlist with System.Data.Common.DbDataRecord listed the correct number of times....but don&#039;t get the actual data....any thoughts? <BR><BR>Thanks!

  2. #2
    Join Date
    Dec 1969

    Default * Try ASP.NET Forum. (eop)


Posting Permissions

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