关于DropDownList在 DataGrid模板中的问题?(只有50分了)(需要叶面分离的 写法)
当我 把DropDownList控件放在DataGrid模板中时,我要将一些数据添加到DropDownList.Items 中时,
总是提示找不到该类型,请各位告诉我 为什么?该程序该怎么写?
private void DataGrid1_Load(object sender, System.EventArgs e)
{
String SqlStr="select * from table1";
String conS="server=LocalHost;UID=sa;Initial Catalog=testDB";
SqlDataAdapter da=new SqlDataAdapter(SqlStr,conS);
DataSet ds = new DataSet();
da.Fill(ds,"tab");
for(Int i=0;i<ds.Tables["tab"].Columns.Count;i++)
{
DropBox.Items.Add(ds.Tables["tab"].Columns[i].ColumnName.ToString());
}
}