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

How to get & set mvc grid readonly cell value

1 Answer 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
veerendra potru
Top achievements
Rank 1
veerendra potru asked on 15 Feb 2012, 10:35 AM
I have a telerik mvc grid with 3 fields and the first 2 are editable.

columns.Bound(x => x.FirstName).Width(120)
columns.Bound(x => x.LastName).Width(120)
columns.Bound(x => x.FullName).Width(120).ReadOnly(); 
.Editable(editing => editing.Mode(GridEditMode.InLine))
.ClientEvents(events => events.OnEdit("onRowEdit"))

Suppose on edit mode, if i make changes for FirstName and LastName I coluld be able to update the FullName filed if it is not readonly(means FullName also need to be editable) with the following code:

function onRowEdit(e) {
        $("#FirstName ').('blur', function () {
          Common();
        });
        $("#LastName ').('blur', function () {
            Common();
        }); 
function Common()
{
$("#FullName").get(0).value   = $("#FirstName").get(0).value + $("#LastName").get(0).value ;
}

The above code works if the FullName field is not readonly. But the FullName filed should be readonly. Any workaround is much appreciated.
Thanks,
Veerendra

1 Answer, 1 is accepted

Sort by
0
Rajesh
Top achievements
Rank 1
answered on 09 Apr 2012, 06:31 AM
Perhaps you should not make the column readonly.. rather set its disabled attribute to true
Tags
Grid
Asked by
veerendra potru
Top achievements
Rank 1
Answers by
Rajesh
Top achievements
Rank 1
Share this question
or