This question is locked. New answers and comments are not allowed.
Hello everybody,
I have a Telerik grid built like this:
var customGrid = new ParticipantCoursGrid();
var grid = customGrid.GetBuilder(Html)
.HtmlAttributes(new Dictionary<string, object> { { "class", "expand" } })
.DataBinding(p => p.Ajax().Select("GetParticipants", "ParticipantCours", new { id_CRS = Model.id_CRS }))
.DataBinding(p => p.Ajax().Update("Edit", "ParticipantCours", new { idCRS_PCR = Model.id_CRS }))
.DataBinding(p => p.Ajax().Insert("Create", "ParticipantCours", new { idCRS_PCR = Model.id_CRS }))
.Name("ParticipantCours")
.ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image))
.Columns(columns =>
{
columns.Bound(type => type.NOM_PRENOM).Title(ViewRes.ParticipantCours.Index.NOM_PRENOM).EditorTemplateName("Personnel");
columns.Bound(type => type.NOM_RPC).Title(ViewRes.ParticipantCours.Index.NOM_RPC).EditorTemplateName("Rol");
columns.Bound(type => type.nom_CLC).Title(ViewRes.ParticipantCours.Index.nom_CLC).ReadOnly();
customGrid.Add_remarques_PCR_Column(columns);
columns.Command(command =>
{
command.EagleEditCommand();
command.EagleDeleteCommand();
}).IncludeInContextMenu(false);
})
.ClientEvents(e => e
.OnRowSelect("handleParticipantCoursGridRowSelect")
.OnRowDataBound("handleParticipantCoursGridRowDataBound")
.OnDataBound("handleParticipantCoursGridDataBound")
.OnDataBinding("handleParticipantCoursGridDataBinding")
.OnEdit("handleParticipantCoursGridEdit")
);
The first two columns are rendered using Razor like this:
@model dynamic
@Html.EagleDropDownList().Name("idRPC_PCR").DataBinding(data=>data.Ajax().Select("RolSelectList","Rol"))
and the same for the Personnel dropdown.
I would like to use Javascript to make them readonly in the OnEdit event when the mode is edit:
function handleParticipantCoursGridEdit(e) {
if (e.mode == 'insert') {
//some code here
}
else{
//mode is edit; add here the code to make the columns unaccesible.
}
_defaulthandleParticipantCoursGridEdit();
}
Any suggestion is a step forward. Thank you in advance.
I have a Telerik grid built like this:
var customGrid = new ParticipantCoursGrid();
var grid = customGrid.GetBuilder(Html)
.HtmlAttributes(new Dictionary<string, object> { { "class", "expand" } })
.DataBinding(p => p.Ajax().Select("GetParticipants", "ParticipantCours", new { id_CRS = Model.id_CRS }))
.DataBinding(p => p.Ajax().Update("Edit", "ParticipantCours", new { idCRS_PCR = Model.id_CRS }))
.DataBinding(p => p.Ajax().Insert("Create", "ParticipantCours", new { idCRS_PCR = Model.id_CRS }))
.Name("ParticipantCours")
.ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image))
.Columns(columns =>
{
columns.Bound(type => type.NOM_PRENOM).Title(ViewRes.ParticipantCours.Index.NOM_PRENOM).EditorTemplateName("Personnel");
columns.Bound(type => type.NOM_RPC).Title(ViewRes.ParticipantCours.Index.NOM_RPC).EditorTemplateName("Rol");
columns.Bound(type => type.nom_CLC).Title(ViewRes.ParticipantCours.Index.nom_CLC).ReadOnly();
customGrid.Add_remarques_PCR_Column(columns);
columns.Command(command =>
{
command.EagleEditCommand();
command.EagleDeleteCommand();
}).IncludeInContextMenu(false);
})
.ClientEvents(e => e
.OnRowSelect("handleParticipantCoursGridRowSelect")
.OnRowDataBound("handleParticipantCoursGridRowDataBound")
.OnDataBound("handleParticipantCoursGridDataBound")
.OnDataBinding("handleParticipantCoursGridDataBinding")
.OnEdit("handleParticipantCoursGridEdit")
);
The first two columns are rendered using Razor like this:
@model dynamic
@Html.EagleDropDownList().Name("idRPC_PCR").DataBinding(data=>data.Ajax().Select("RolSelectList","Rol"))
and the same for the Personnel dropdown.
I would like to use Javascript to make them readonly in the OnEdit event when the mode is edit:
function handleParticipantCoursGridEdit(e) {
if (e.mode == 'insert') {
//some code here
}
else{
//mode is edit; add here the code to make the columns unaccesible.
}
_defaulthandleParticipantCoursGridEdit();
}
Any suggestion is a step forward. Thank you in advance.