0
我从代码创建一个动态下拉列表后面:添加一个动态的DropDownList到GridView(然后导出到Excel)
protected void test_RowDataBound(object sender, GridViewRowEventArgs e)
{
DropDownList ddlSelection = new DropDownList();
string value = "";
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRow row = ((DataRowView)e.Row.DataItem).Row;
value = row.Field<String>("[First Row]");
}
List<string> mylist = new List<string>();
mylist.Add("NORMAL");
mylist.Add("LOW");
ddlSelection.DataSource = mylist;
ddlSelection.DataBind();
ddlSelection.SelectedValue = value;
e.Row.Cells[0].Controls.Add(ddlSelection);
}
然后我将其导出到Excel。一切都很好,希望DropDownList需要放在单元格内(cf:下面的图片)。
的DropDownList的推移其细胞外。我怎么能修好它?
您是如何将dropdownlist控件导出为excel的? –