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

Hide Read Only Grid Column

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Angie
Top achievements
Rank 1
Angie asked on 28 Oct 2008, 04:45 PM
I have a couple of columns in my grid view set to Read Only.  According to some documentation, this property should automatically hide that column on Edit and Insert, correct?   Of course, other documentation says that this feature is not working in the "current version", but doesn't specifiy what the current version is. 

I would like some clarification please.

If I set my column to Read Only, I would like it to not be visible in Edit Mode (including the header). What is the best way to achieve this?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 29 Oct 2008, 11:36 AM
Hi Angie,

The following example demonstrates a readOnly field. This does not render the field in edit mode. The column, however, is visible. You can hide it as well, in the prerender event handler, for example by checking if any items are in edit mode.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Josh
Top achievements
Rank 1
answered on 13 Feb 2009, 05:34 PM
Can you tell me how to do the opposite?  I want a column to be hidden in select mode but visible in the edit / insert form.

Thanks,
Josh
0
Shinu
Top achievements
Rank 1
answered on 16 Feb 2009, 05:13 AM

Hi Josh,

I am not sure if you using the EditMode as EditForm or InPlace. If you are using EditForm mode, you can set the Visibility property to achieve the scenario. Setting the Visibility property to false will show the column only in EditMode, not in the normal mode.

ASPX:

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateEditColumn="True" DataSourceID="SqlDataSource1"
<MasterTableView DataSourceID="SqlDataSource1" EditMode="EditForms"
<Columns>     
        <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32"  ReadOnly="true" 
            HeaderText="OrderID" SortExpression="OrderID" UniqueName="OrderID"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" Visible="false"  
            SortExpression="CustomerID" UniqueName="CustomerID"
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
</telerik:RadGrid> 

Thanks,

Shinu.

Tags
Grid
Asked by
Angie
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Josh
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or