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

Set specific columns to be in edit mode on PreRender

2 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 13 Jun 2014, 06:23 PM
When the grid first loads I want specific columns to be editable.

I have a checkbox that i want to allow the user to change. Upon changing the checkbox i will then trigger an event that will make other columns become editable.


I know how to set all columns to editable with the following:

foreach (GridItem item in RadGrid1.MasterTableView.Items)
               {
                    
                   if (item is GridEditableItem)
                   {
                       GridEditableItem editableItem = item as GridDataItem;
                       editableItem.Edit = true;
                   }
               }
               RadGrid1.Rebind();

I also know how to get the specific column that I want to set the edit mode on:

foreach (GridColumn column in RadGrid1.Columns)
                {
                    if (column.UniqueName == "Reserved")
                    {
                        if (column is GridEditableColumn)
                        {
                            GridEditableColumn editableColumn = column as GridEditableColumn;
                        }
                    }  
}


However I am not sure how to bridge the gap here.

I'm sure the answer is simple but I'm missing it for the moment.

Thx

2 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 18 Jun 2014, 08:20 AM
Hello Julian,

I could suggest you two approaches for achieving the desired result.

The first option would be to set the ReadOnly property of all columns but the one with the check box to false and once you want to enable the editing for the other column, set it to true.

The second approach is the one documented in our help article ReadOnly Mode for Individual Cells, where you could make all cells to be ReadOnly, except the ones that you need to be editable.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Julian
Top achievements
Rank 1
answered on 18 Jun 2014, 03:22 PM
Yes I came to this conclusion shortly after making the post. However, I've decided to go with a custom popup edit form. From within this form I will setup columns that are editable. Should prove interesting.

thanks!
Tags
Grid
Asked by
Julian
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Julian
Top achievements
Rank 1
Share this question
or