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

Edit column (sometimes)

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 02 Jul 2010, 05:06 PM
Hi,
    This may be basic, but I can't see where to configure what I want:
    I'd like to have an edit (button) column autogenerated on my detail table, but not on the master table.  How do I do this?
    Thanks,
        Ben

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Jul 2010, 06:23 AM
Hello Ben,

One suggestion is adding GridEditCommandColumn to the column collection of DetailsTableView instead of showing AutoGenaretedEditColumn (while setting AutoGenerateEditColumn proerty to false).

Another option is hiding the AutoGeneratedEditColumn of MasterTableView from code behind.
Mark-up:
 
    
<telerik:RadGrid ID="RadGrid1" AllowMultiRowSelection="true"    
    runat="server" DataSourceID="SqlDataSource1" PageSize="10"      
AutoGenerateEditColumn="true" " OnColumnCreated="RadGrid1_ColumnCreated"  ...> 
    <MasterTableView CommandItemDisplay="Top" 
                DataKeyNames="CustomerID" DataSourceID="SqlDataSource1"  Name="Master" . . > 


C#:
 
    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)  
    {  
        if (e.Column.UniqueName == "AutoGeneratedEditColumn")  
        {  
            Response.Write(e.Column.UniqueName);  
            if (e.OwnerTableView.Name == "Master")  
            {  
                e.Column.Visible = false;  
            }  
        }  
    } 

Thanks,
Princy.
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or