3 Answers, 1 is accepted
For example:
namespace Telerik.Web.Mvc.Examples.Models{ using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; public class ClientEditableOrder { [ReadOnly(true)] public int OrderID { get; set; } [UIHint("ClientEmployee"), Required] public string Employee { get; set; } [DataType(DataType.Date), Required] public DateTime OrderDate { get; set; } [DataType(DataType.Currency), Required] public decimal Freight { get; set; } }}
ReadOnly is not working when using GridEditMode.PopUp for editing.
I tried it in both ways:
I put the attribute above the field "[ReadOnly(true)]"
I also tried to put ReadOnly in the columns bound:
@(Html.Telerik().Grid(Model)
.Name(
"Grid")
.ClientEvents(events => events.OnLoad(
"onGridLoad"))
.DataKeys(keys => { keys.Add(d => d.ID); })
.Columns(columns =>
{
columns.Command(commands =>
{
commands.Edit().ButtonType(
GridButtonType.Image);
}).Width(60).Title(
" ");
columns.Bound(d => d.ID).Width(100).ReadOnly(
true);
columns.Bound(d => d.SoftwareVersion).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.IMEI).Width(100);
columns.Bound(d => d.RegistrationTime).Format(
"{0:MM/dd/yyyy}").Width(100);
})
.DataBinding(dataBinding => dataBinding.Ajax()
.Select(
"_AjaxParametersGrid", "Activities")
.Update(
"_SaveParametersEditing", "Grid"))
.Editable(editing => editing.Mode(mode))
.Pageable(paging => paging.Total((
int)ViewData["total"]))
.EnableCustomBinding(
true)
.Sortable()
.Scrollable(scrolling => scrolling.Height(390))
)
The inline editing is working fine but not good for me.
Please help
Alon
You can check this entry from the grid troubleshooting help article.
Greetings,Atanas Korchev
the Telerik team