后台控制GridView中Itemtemplate中控件属性

1、foreach(GridViewRow gr in gridview1.Rows)
{
LinkButton l=gr.FindControls("LinkButton1") as LinkButton;
}
2、Visible='<%# GetVisible(Eval("id"))%>'
public bool GetVisible(object x){return true;};

3、

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
           LinkButton cb = (LinkButton)this.GridView1.Rows[e.RowIndex].FindControl("LinkButton1");
      }

 

posted @ 2017-05-18 13:33  SkyLeo  阅读(1301)  评论(0编辑  收藏  举报