This is a migrated thread and some comments may be shown as answers.

Remove Expand/Collapse

1 Answer 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
SUBIN
Top achievements
Rank 1
SUBIN asked on 02 Feb 2013, 06:30 AM
Hello,
I wanna remove expand/collapse property when no child items in hierarchical grid.I wanna remove particular cell expand/collapse only

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 03 Feb 2013, 04:05 PM
Hello,

public static void HideExpandColumnRecursive(GridDataItemCollection items)
        {
            foreach (GridDataItem item in items)
            {
                if (item["ID"].Text == "1") // Put your condition here
                {
                    foreach (GridTableView nestedViewItem in item.ChildItem.NestedTableViews)
                    {
                        if (nestedViewItem.Items.Count == 0)
                        {
                            System.Web.UI.WebControls.TableCell cell = nestedViewItem.ParentItem["ExpandColumn"];
 
                            if (cell.Controls.Count == 0)
                            {
                            }
                            else
                            {
                                cell.Controls[0].Visible = false;
                            }
                            nestedViewItem.Visible = false;
                        }
                    }
                }
            }
        }
 
    protected void Page_PreRender(object sender, EventArgs e)
        {
            HideExpandColumnRecursive(RadGrid1.MasterTableView.Items);
        }


Thanks,
Jayesh Goyani
Tags
General Discussions
Asked by
SUBIN
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or