社区
VB
帖子详情
vb.net Gridview RowCommand事件中 如何获取控件
chen380008006
2011-05-12 10:45:25
如题。。。。 CommandName 和 CommandArgument 属性已经被使用。
...全文
279
10
打赏
收藏
vb.net Gridview RowCommand事件中 如何获取控件
如题。。。。 CommandName 和 CommandArgument 属性已经被使用。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
10 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
hykhym
2011-09-07
打赏
举报
回复
路过学习
chen380008006
2011-05-12
打赏
举报
回复
[Quote=引用 8 楼 zhangxiaomei_it 的回复:]
Dim rows As GridViewRow = CType(CType(e.CommandSource, Control).Parent.Parent,GridViewRow)
Dim str As String = CType(rows.FindControl("Textbox1"), TextBox).Text
[/Quote]
很好用没的说。
zhangxiaomei_it
2011-05-12
打赏
举报
回复
Dim rows As GridViewRow = CType(CType(e.CommandSource, Control).Parent.Parent,GridViewRow)
Dim str As String = CType(rows.FindControl("Textbox1"), TextBox).Text
gxingmin
2011-05-12
打赏
举报
回复
http://zhidao.baidu.com/question/75256788.html
你参考这个
chen380008006
2011-05-12
打赏
举报
回复
[Quote=引用 5 楼 gxingmin 的回复:]
这个是控件id,因为FindControl只能根据id查找,
[/Quote]
5555555 前辈 我是真不明白了 可否 给段代码啊 分都给你。。。。。
gxingmin
2011-05-12
打赏
举报
回复
这个是控件id,因为FindControl只能根据id查找,
chen380008006
2011-05-12
打赏
举报
回复
[Quote=引用 3 楼 gxingmin 的回复:]
方法2,
假设你在前台这样绑定的
CommandArgument='<%# Eval("ser_ID") + "|" + "LinkButton3" %>'
在后台你可以这样
string []s = e.CommandArgument.ToString().Split('|');
s[0]为你以前要绑定的e.CommandArgument值
gridView1.FindCont……
[/Quote]
LinkButton3 这个 字符串 我看作他是 value 还是控件ID 如果是 控件ID 我一样点不出来 控件中的values 可不可以我直接把value拼上
gxingmin
2011-05-12
打赏
举报
回复
方法2,
假设你在前台这样绑定的
CommandArgument='<%# Eval("ser_ID") + "|" + "LinkButton3" %>'
在后台你可以这样
string []s = e.CommandArgument.ToString().Split('|');
s[0]为你以前要绑定的e.CommandArgument值
gridView1.FindControl(s[1]); //你要找的控件LinkButton3
chen380008006
2011-05-12
打赏
举报
回复
[Quote=引用 1 楼 gxingmin 的回复:]
方法1:
e.Item.FindControl(控件id)
方法2:
把控件和其他信息连接在一起(中间用一个符号隔开)绑定给CommandArgument 属性,在后台再把CommandArgument 值根据隔开的那个符号拆分开来
[/Quote]
方法1: 事件源是 GridViewCommandEventArgs 没有 e.Item
方法2 我不会写 希望明细一点谢谢
gxingmin
2011-05-12
打赏
举报
回复
方法1:
e.Item.FindControl(控件id)
方法2:
把控件和其他信息连接在一起(中间用一个符号隔开)绑定给CommandArgument 属性,在后台再把CommandArgument 值根据隔开的那个符号拆分开来
GridView
的
Row
Command
事件
中
取得
控件
值
GridView
Command
EventArgs类未包含一个用于指示单击按钮所在行的属性。如果需要知道哪个行引发了
事件
,请使用
Command
Argument属性将行的索引传给
事件
处理方法。 所以你要先在
Row
Created(其
中
Test是按钮的
Command
Name) protectedvoid
GridView
1_
Row
Created(objectsender,Gr...
[
GridView
]在
Row
Command
事件
中
,自订的Button 如何取出某一列的索引值(
Row
Index)
这是我的文章备份,有空请到我的网站走走, http://www.dotblogs.com.tw/mis2000lab/ 才能掌握我提供的第一手信息,谢谢您。 http://www.dotblogs.com.tw/mis2000lab/archive/2011/09/08/
gridview
_selectedindex_dataitemindex...
vb.net
2008的
gridview
中
如何取得ButtonField的text值和boundfield的值
Protected Sub
GridView
1_
Row
Command
(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.
GridView
Command
EventArgs) Handles
GridView
1.
Row
Command
Convert the
row
index stored in the C
获取
GridView
控件
中
指定列的值
我们知道在
GridView
中
当我们单击按钮的时候,就会触发
Row
Command
事件
,因此我们可以通过使用此
事件
来获得
Gridview
控制
中
的值! 在
GridView
控件
中
的BoundField字段都有一个
Command
Name属性,通过获得它的属性值来判断我们单击的是那一列字段。 下面请看代码: protectedvoid
GridView
1_
Row
Command
...
gridview
中
获取
主键的值方法
在
GridView
1_
Row
Command
中
获取
主键的值: protected void
GridView
1_
Row
Command
(object sender,
GridView
Command
EventArgs e) { int OrderId = Convert.ToInt32(
GridView
1.DataKeys[Convert.ToInt32(e.
Command
Argument)
VB
16,718
社区成员
110,521
社区内容
发帖
与我相关
我的任务
VB
VB技术相关讨论,主要为经典vb,即VB6.0
复制链接
扫一扫
分享
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章