GridView添加了一列DropDownList1,我在GridView中加一个保存的按钮,点击按钮的时候,怎么取得当前行DropDownList1列的值呢?
解决方案 »
- 页面多参数传递,如何传
- 关于ADO.NET得一些问题?
- 请教一下asp.net 页面播放视频文件得用到什么控件?代码怎样实现的?
- 如何用JS播放wav文件
- 创建事件出错?
- 郁闷快死:在自己电脑上用查询分析器能连上另一台电脑上的mssql2000数据库,可是在asp.net程序中却报错如下:SQL Server 不存在或访问被
- EF to Linq 执行增删改查 例子 怎么做
- 超难题,挑战各位高手: 传入一文件名,然后要根据该文件后缀显示该文件内容?
- asp.net中如何在页面中实现输入不同的类型存入数据库中不同的表中
- 我用Request.InputStream接收流文件,存储后开头跟结尾多了一部分代码
- -------------<%#Eval("ProductID") %>这样格式的跳转传值
- win7系统 可以用C#操作excel2007吗?
//button _click事件中:
GridViewRow row = (sender as Button).Parent.Parent as GridViewRow;
DropDownList ddl=row.FindControl("DropDownList1") as DropDownList;
}
(不过大师前一种方法在GridView1_RowCommand方法中貌似也能用 )
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow selectRow = GridView1.Rows[index];
}
或Control cmdControl = e.CommandSource as Control;
row = cmdControl.NamingContainer as GridViewRow;
string str = row.Cell[0].Text;