文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>在Gridview中获取当前行的GridviewRow对象

在Gridview中获取当前行的GridviewRow对象

时间:2010-10-15  来源:小天孔孔

正文

很自然想到的第一个方法就是Parent属性,使用两个Parent就可以得到GridviewRow对象,第一个Parent得到的是DataControlFieldCell。

    protected void btnDisplay_Command(object sender, CommandEventArgs e)
    {
        Button btnDisplay = sender as Button;
        GridViewRow row = btnDisplay.Parent.Parent as GridViewRow;
    }

 第二个方法就比较便利,直接使用NamingContainer,可以得到GridviewRow。

protected void btnDisplay_Command(object sender, CommandEventArgs e)
{
    Button btnDisplay = sender as Button;
    GridViewRow row = btnDisplay.NamingContainer as GridViewRow;
}

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载