1.现有一个GridView
2.给此控件添加一个模板
3.在模板里放入一个DropDownList控件
4.在GridView外放一个按钮
5.要实现的内容:运行后GridView显示一列DropDownList控件,
6.我的问题是:单击GridView外的按钮,如何获取某一行的DropDownList的Text值
谢谢!
2.给此控件添加一个模板
3.在模板里放入一个DropDownList控件
4.在GridView外放一个按钮
5.要实现的内容:运行后GridView显示一列DropDownList控件,
6.我的问题是:单击GridView外的按钮,如何获取某一行的DropDownList的Text值
谢谢!
DropDownList dropdownlist1 = (DropDownList)grdShow.Rows["行数"].Cells["列数"].FindContro("DropDownList1");
DropDownList dd=GridView1.Rows[0].FindControl("DropDownList1") as DropDownList;
{
DropDownList ch = (DropDownListch)gvr.FindControl("DropDownList1");
}
然后DropDownList dropdownlist1 = (DropDownList)grdShow.Rows[全局变量].Cells["列数"].FindContro("DropDownList1");
http://dotnet.aspx.cc/file/Add-Delete-Update-Edit-Data-With-Paging-in-GridView.aspx
关键是你的行号怎么确定的
是点击行?还是点击那行的按钮?
http://dotnet.aspx.cc/file/Add-Delete-Update-Edit-Data-With-Paging-in-GridView.aspx这个例子很能说明问题了
{
GridViewRow gvr = (sender as LinkButton).NamingContainer as GridViewRow;
DropDownList txt=gvr.FindControl("ddl") as DropDownList ;
}