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

Hide detail tables

6 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 03 Nov 2008, 07:39 PM
We want to make the ability to see detailtables permission based.  some may get no detail tables, some may get detailtable 0 and others detailtable 1.  Users with no permissions should not see the "+" at all

 grid1.MasterTableView.DetailTables(0).Visible = False

doesn't seem to get the job done.  Any ideas?  Permissions won't be set until after a postback.

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 04 Nov 2008, 05:25 AM
Hi Joel,

Try with the following approach and see if it helps.

CS:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            if (item.Expanded) 
            { 
                //Check for the Permission here and then set visibility 
                item.ChildItem.NestedTableViews[0].Visible = false
                
            } 
        } 
    } 


Thanks
Shinu.
0
Joel
Top achievements
Rank 2
answered on 04 Nov 2008, 03:19 PM
Thank you Shinu.

I had seen similar attempts in other postings.  This hides the contents of the detail table, but only after expansion.  What I am looking for is the mastertable to not have the the expansion column at all.   Having a "+" that does nothing will be kicked back as a bug.  Any other ideas?

-Joel




0
Accepted
Shinu
Top achievements
Rank 1
answered on 05 Nov 2008, 04:16 AM
Hi Joel,

Here is the code snippet to hide the Expand/Collapse image in the Expand/Collapse column of a Hierarchical Grid.

CS:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            TableCell cell = item["ExpandColumn"]; 
            cell.Controls[0].Visible = false
        } 
 
         
    } 


Thanks
Shinu.
0
Idrise
Top achievements
Rank 1
answered on 11 Nov 2008, 05:58 PM
((GridDataItem)e.Item)["ExpandColumn"].Controls[0].Visible = false;

Seems to preserve the formatting, the other way ( ((GridDataItem)e.Item)["ExpandColumn"].Enabled = false; ) gets the alignment out of whack.
0
ghadeer
Top achievements
Rank 1
answered on 20 Nov 2008, 09:32 AM
hello there
please you can rewrite for me with condition .....
thanks in advance
ghadeer
0
Idrise
Top achievements
Rank 1
answered on 20 Nov 2008, 05:08 PM
I didn't get your question.
Tags
Grid
Asked by
Joel
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 1
Joel
Top achievements
Rank 2
Idrise
Top achievements
Rank 1
ghadeer
Top achievements
Rank 1
Share this question
or