源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

在RowCommand事件中获取索引值示例代码

  • 时间:2021-03-25 10:08 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:在RowCommand事件中获取索引值示例代码
在RowCommand事件中获取索引值 1.利用e.CommandSource
[u]复制代码[/u] 代码如下:
protected void lpg_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ItemCollect") { GridViewRow gvr = (GridViewRow)(((LinkButton)(e.CommandSource)).NamingContainer); LinkButton lk = lpgKnowledgeExchange.Rows[gvr.RowIndex].FindControl("lbtnCollect") as LinkButton; } }
2.如果是模板列中的button直接click事件 利用sender 取其parent 也可以实现
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部