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

Access DetailTable Columns

1 Answer 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 26 Mar 2009, 01:10 PM
I am using Rad Controls 2008 Q3 with Visual Studio 2008, C#, and .netFramework 3.5.

I have two issues:

I have a MasterTableView and two DetailTables.  I need to programmaticially control the display of Edit and Delete columns based on a user's permissions.  For example, I am using Grid.Columns.FindByUniqueName("MasterDelColumn") to locate the Delete column in the MasterTableView.  However, when I try Grid.Columns.FindByUniqueName("DetailDelColumn") to locate the Delete column in the DetailTables, the program displays the following error: Cannot find column with UniqueName 'DetailDelColumn'.  How do I locate the columns in the DetailTables programmatically?

I also need to display/hide the "Expand" icon, also based on a user's permissions.  Is there any way to set the "Expand" icon Visible = false programmatically?


Thank you,
Jack

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Mar 2009, 08:39 AM
Hello Jack,

You can access the detail table column using its name property and then hide the column using the above code as shown below:

private void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)  
{         
       if (e.Item.OwnerTableView.Name == "DetailTableName")  
       {  
              GridColumn col = e.Item.OwnerTableView.Columns.FindByUniqueName("asd"); 
       }  
}  
 

Also refer to the following link, for more information on how to distinguish between the master and detail tables.

Distinguish grid rows in hierarchy on ItemCreated/ItemDataBound

Thanks

Princy.

Tags
Grid
Asked by
Jack
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or