| 网站首页 | 建站学院 | 资源下载 | 建站教程 | 图片素材 | 网贝社区 | 
您现在的位置: 网贝建站 >> 建站学院 >> ASP.NET >> winform应用 >> 正文 用户登录 新用户注册
专 题 栏 目
最 新 热 门
最 新 推 荐
相 关 文 章
DataGrid在PostBack后定
DataGrid的EditCommandC
方便的使用单击和双击更
为DataGrid添加自定义Da
如何用DataGrid实现类似
嵌套的DataGrid如何为子
如何利用DataGrid纵向显
联合主键的情况怎么在Da
有的时候DataGrid取值取
怎么触发DataGrid模板列
[组图]DataGrid模板列中控件的事件中怎么知道是哪行触发的事件?         ★★★
DataGrid模板列中控件的事件中怎么知道是哪行触发的事件?
作者:lovecher… 文章来源:http://www.cnblogs.com/lovecherry 点击数: 更新时间:2005-6-21 1:36:52

http://www.netbei.com/Article/aspx/aspx7/200506/3881.html中说了怎么在触发DataGrid模板列中控件自己的事件,网友问怎么知道点击的是哪一行?要通过这个来获取中的信息。
那一行DataGridItem是

((DataGridItem)((DropDownList)sender).Parent)
吗?不是,因为((DataGridItem)((CheckBox)sender).Parent)是TableCell
其实应该是
((DataGridItem)((DropDownList)sender).Parent.Parent)
接下来你想怎么就怎么了。

输出行号:
Response.Write(((DataGridItem)((DropDownList)sender).Parent.Parent).ItemIndex);
输出值:
Response.Write(((DataGridItem)((DropDownList)sender).Parent.Parent).Cells[0].Text);
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)