Hello,
I have an <asp:table> control and inside this i am dynamically adding
dropdownlists depending on values in the database. Whenever i try to
bind any data to the HtmlSelect controls they completly disapear, the
correct number show up without binding thus i know that its getting
the correct values from teh dbase. here is teh code ive left in the
the databind bit..
//table
//add table and adjust rows according to dbase.
int numrows = objDataSet.Tabl e["TheTopic"].Rows.Count;
int temprow=0;
int numcells = 1;
for (int j=0; j<numrows; j++) {
//define new instance of table row object
TableRow r = new TableRow();
try{
//loop for your life!
for (int i=0; i<numcells; i++) {
//define new instance of table cell object
TableCell c = new TableCell();
r.Cells.Add(c);
//define new instance of HtmlInputCheckB ox object
HtmlSelect dropper = new HtmlSelect();
//assign an ID that we can use to find the control later
dropper.ID = "select_"+objDa taSet.Tables["TheTopic"].Rows[temprow]["tblTopicID "].ToString();
dropper.DataSou rce = objDataSet.Tabl es["TheTopic"];
dropper.DataTex tField=
objDataSet.Tabl es["TheTopic"].Rows[temprow]["tblTopicID "].ToString();
dropper.DataVal ueField=
objDataSet.Tabl es["TheTopic"].Rows[temprow]["tblTopicID "].ToString();
//dropper.EnableV iewState=true;
dropper.DataBin d();
dropper.Visible =true;
c.Controls.Add( dropper);
//c.Controls.Add( new LiteralControl( "<br>"));
temprow++;
}
}
catch{
TableCell c = new TableCell();
r.Cells.Add(c);
}
Table1.Rows.Add (r);
}
any ideas??
I have an <asp:table> control and inside this i am dynamically adding
dropdownlists depending on values in the database. Whenever i try to
bind any data to the HtmlSelect controls they completly disapear, the
correct number show up without binding thus i know that its getting
the correct values from teh dbase. here is teh code ive left in the
the databind bit..
//table
//add table and adjust rows according to dbase.
int numrows = objDataSet.Tabl e["TheTopic"].Rows.Count;
int temprow=0;
int numcells = 1;
for (int j=0; j<numrows; j++) {
//define new instance of table row object
TableRow r = new TableRow();
try{
//loop for your life!
for (int i=0; i<numcells; i++) {
//define new instance of table cell object
TableCell c = new TableCell();
r.Cells.Add(c);
//define new instance of HtmlInputCheckB ox object
HtmlSelect dropper = new HtmlSelect();
//assign an ID that we can use to find the control later
dropper.ID = "select_"+objDa taSet.Tables["TheTopic"].Rows[temprow]["tblTopicID "].ToString();
dropper.DataSou rce = objDataSet.Tabl es["TheTopic"];
dropper.DataTex tField=
objDataSet.Tabl es["TheTopic"].Rows[temprow]["tblTopicID "].ToString();
dropper.DataVal ueField=
objDataSet.Tabl es["TheTopic"].Rows[temprow]["tblTopicID "].ToString();
//dropper.EnableV iewState=true;
dropper.DataBin d();
dropper.Visible =true;
c.Controls.Add( dropper);
//c.Controls.Add( new LiteralControl( "<br>"));
temprow++;
}
}
catch{
TableCell c = new TableCell();
r.Cells.Add(c);
}
Table1.Rows.Add (r);
}
any ideas??