文章详情

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

 

排行榜 更多 +
我狙打得贼六2安卓版

我狙打得贼六2安卓版

飞行射击 下载
疯狂坦克争霸战最新版

疯狂坦克争霸战最新版

飞行射击 下载
王者狙击精英最新版

王者狙击精英最新版

飞行射击 下载