我的GridView前面加了三列选项,是用TemplateField加的.然后在RowCommand事件中加以处理.但是为什么说Convert.ToInt32(e.CommandArgument)这句类型不能转换呢?我调试的时候发现e.CommandArgument好象是一个空值,但我看MSDN上就这样用的呀,正确用法为何?请诸君为我解惑.
switch (e.CommandName)
{
case "Del":
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
ListItem item = new ListItem();
item.Text = Server.HtmlDecode(row.Cells[3].Text);
parString = item.Text;
break;
}
又,如果您有能在GridView中得到选中行的单元格的内容的方法,也请一并赐教.最好贴出例子代码.此问如解决,分可全归此问.
switch (e.CommandName)
{
case "Del":
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
ListItem item = new ListItem();
item.Text = Server.HtmlDecode(row.Cells[3].Text);
parString = item.Text;
break;
}
又,如果您有能在GridView中得到选中行的单元格的内容的方法,也请一并赐教.最好贴出例子代码.此问如解决,分可全归此问.
解决方案 »
- 求一个oracle去重复并分页的sql语句
- 在验证控件中,如何用正则表达式检测只能输入不为0.00的数字?
- 网站中数据库访问时是否必须要使用lock语句? 另含其他几个相关问题
- “/MapXtremeWebApplicationCS2”应用程序中的服务器错误。
- 权限问题 在线等啊~!!!!!
- asp代码如何用asp.net(c#)实现^_^
- 谁来教我一下该组件的使用?如何把得到的地名写进数据库?
- 高兴!散分!顺便问个简单的问题!
- 我快要发疯了,请各位大侠救救我
- 我的机子无法创建webapplication,系统为win2000server,怎么办?
- 100分 得到答案马上结帖!!!!!
- build web site后文件在哪儿
要用int index = Convert.ToInt32(e.CommandArgument);这个,你的点击事件的那个控件在gridview里要用ButtonField按钮
不知道为什么,汗,如果用linkbutton按钮,它的CommandName传过去就是不能用,郁闷
取不到值