Imagebutton in Hirerchical Radgrid Detailview

2 posts, 0 answers
  1. Amol
    Amol avatar
    57 posts
    Member since:
    Apr 2008

    Posted 30 Jun 2009 Link to this post

    Hello Friends,

    I have a Hierarchical Rad grid which contains 4 level of Hierarchy.

    On the 2nd, 3rd and 4th Hierarchy of grid, there is a template column which contains one imagebutton.

    My requirement is to hide the imagebutton on the last row of  each hierarchical grid.

    I had tried on Page_Pre-render event using

                  ImageButton downButtonPosition = (ImageButton)radgrid.MasterTableView.DetailTables[0].Items[radgrid.MasterTableView.DetailTables[0].Items.Count - 1].FindControl("ibtnDown");

    Now to retrieve last row of DetailTable of Radgrid and On Which event i can get it?

    Thanks in Advance

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Jun 2009 Link to this post

    Hi Amol,

    You can access ImageButton for the last row of the desired table level in the ItemDataBound event  and hide it as shown below.

      protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
           if((e.Item is GridDataItem)&&(e.Item.OwnerTableView.Name=="Detail")&&(e.Item.ItemIndex==RadGrid1.MasterTableView.Items.Count-1)) 
                GridDataItem item = (GridDataItem)e.Item; 
                ImageButton imgbtn = (ImageButton)item.FindControl("ImageButton1"); 
                imgbtn.Visible = false

Back to Top