By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Dynamic Troubles

P: n/a
Does anyone know how I can bind these dropdowns to a
reader?

HtmlTable tbl = new HtmlTable();
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell td1 = new HtmlTableCell();
HtmlTableCell td2 = new HtmlTableCell();
HtmlTableCell td3 = new HtmlTableCell();
HtmlTableCell td4 = new HtmlTableCell();

// Create a textbox and a dropdown to hold the values
td2.Controls.Add(new TextBox());
td4.Controls.Add(new DropDownList());

// Name the objects
td2.ID = "txtCassette" +(i+1);
td4.ID = "ddlDenomination" +(i+1);

// Put the text in the empty cells
td1.InnerHtml = "Cassette #" +(i+1);
td3.InnerHtml = "Denomination";

// Add the cells to the row
tr.Cells.Add(td1);
tr.Cells.Add(td2);
tr.Cells.Add(td3);
tr.Cells.Add(td4);

// Add the row to the table
tbl.Rows.Add(tr);

// Add the table to the placeholder
Container.Controls.Add(tbl);

--This is the part that is broke that I need help with--
//ddlDenomination(i).DataSource = cmd.ExecuteReader();
//ddlDenomination(i).DataTextField = "name";
//ddlDenomination(i).DataValueField = "denominationid";
//ddlDenomination(i).DataBind();

//Loop
i++;
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.