文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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;
}

 

排行榜 更多 +
我在末日当牛马MOD菜单

我在末日当牛马MOD菜单

冒险解谜 下载
麻辣烫大师中文版免广告

麻辣烫大师中文版免广告

模拟经营 下载
麻辣烫大师无限金币版游戏

麻辣烫大师无限金币版游戏

模拟经营 下载