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

[Solved] How to disable a field in edit mode

2 Answers 292 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 16 Apr 2009, 06:47 AM
Hi All

I have radgrid with employee informations

There some fields like (first name, middle name, last name, dob, address, doj, designation,username password and status(active/inactive))

The active/inactive is a check box.

<

telerik:RadGrid ID="RadGrid1" runat="server" Skin="WebBlue"  GridLines="None" AllowPaging="True" AllowSorting="True" Width="97%" AutoGenerateColumns="False" ShowStatusBar="true" OnPreRender="RadGrid1_PreRender" OnNeedDataSource="RadGrid1_NeedDataSource"  OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand">

 

 

 

My problem is.

When a employee logins, he should not be able to change his status(active/inactive) .

So is there any way to change the enable option to false for the check box(active/inactive) in edit mode only for the logged in user.

Thank u in advance

-Anto

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Apr 2009, 08:49 AM
Hello Anto,

You can set the ReadOnly property of your GridCheckBoxColumn (if this is your scenario) to make sure that the value can't edited
<telerik:GridCheckBoxColumn  
    DataField="myBooleanColumn"  
    UniqueName="myBooleanColumn"  
    HeaderText="Active"
</telerik:GridCheckBoxColumn> 

You can set this property conditionally as shown below:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    GridCheckBoxColumn cbCol = RadGrid1.MasterTableView.GetColumn("myBooleanColumn"as GridCheckBoxColumn; 
    if (!some_condition) 
        cbCol.ReadOnly = true

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
answered on 20 Jun 2009, 08:44 AM
Hi Daniel

Thank You,

But I have solved it.

-Anto
Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Share this question
or