【发布时间】:2013-03-13 20:08:23
【问题描述】:
我知道如何在 RowDataBound 事件中获取 templatefield 的值:
Control ctrl = e.Row.FindControl("Drop_Responsaveis");
DropDownList ddl = ctrl as DropDownList;
ddl.items.add(something);
但我需要在 button_Click 事件中获得它的价值...我该怎么做?
@Siz S 回答的解决方案
foreach (GridViewRow gvr in GridView1.Rows)
{
string str = ""
Control ctrl = gvr.FindControl("Drop_Responsaveis");
if (ctrl != null)
{
DropDownList ddl = ctrl as DropDownList;
str= ddl.SelectedItem.ToString();
}
}
【问题讨论】:
-
为什么有人试图关闭我的问题而不发表评论说明原因...
标签: asp.net gridview templatefield