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

[Solved] hidden/read-only for an autogenerated column?

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 05 Aug 2009, 08:46 PM
I have several similar but not identical tables (which I'm binding various comboboxes to), and I'd like to use one form to edit them all.  Using autogenerated columns works fine, except I'd like to hide the primary key columns since the contents are meaningless and confusing for end users.  Is there any way to do this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 06 Aug 2009, 05:26 AM
Hello Chris,

You can hide the autogenerated column using its UniqueName which would same as the DataField of the column:
c#:
 protected void RadGrid1_PreRender1(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.GetColumn("TitleOfCourtesy").Visible = false
    } 

You can add this field as the DataKeyNames collection so as to retrieve values, when the column is hidden. Refer to the following to learn more about DataKeyNames:
Retrieving primary key field values for selected items

Thanks
Princy.

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