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

Error in Grid's Components - EditMode

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcos
Top achievements
Rank 1
Marcos asked on 21 Feb 2013, 08:58 PM
Hi!

I'm sorry for my bad english.

I have a problem with grid's components, when the grid is in edit mode don't show kendo's components but a asp.Net MVC components.

ViewModel:
    public class ProjetoViewModel
    {
        public int IdProjeto { get; set; }
        [DisplayName("CodigoProjeto")]
        public string CodigoProjeto { get; set; }
        [DisplayName("Nome")]
        [DataType(DataType.Text)]
        public string Nome { get; set; }
        [DisplayName("AnoInicial")]
        [DataType("Integer")]
        [Range(0, int.MaxValue)]
        public int AnoInicial { get; set; }
    }

Grid:
@(Html.Kendo().Grid<DemurrageWeb_ViewModel.Sistema.ProjetoViewModel>()
        .Name("GridProjeto")
        .Columns(columns =>
        {
            columns.Command(command =>
            {
                command.Destroy().HtmlAttributes(new { @title = @DemurrageWeb_Resource.Util.Button.Excluir });
                command.Edit().HtmlAttributes(new { @title = @DemurrageWeb_Resource.Util.Button.Alterar });
            }).Width(111).HtmlAttributes(new { @class = "Icon" });
            columns.Bound(p => p.IdProjeto).Hidden(true);
            columns.Bound(p => p.Nome).Width("50%");
            columns.Bound(p => p.CodigoProjeto).Width("30%");
            columns.Bound(p => p.AnoInicial).Width("20%");
        })
        .ToolBar(toolbar =>
        {
            toolbar.Create().Text("").HtmlAttributes(new { @class = "Icon icAdd", @title = @DemurrageWeb_Resource.Util.Button.Inserir });
        })
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Pageable(pg =>
        {
            pg.Refresh(true);
            pg.PageSizes(new[] { 10, 20, 30 });
            pg.Input(true); pg.Numeric(false);
        })
        .Sortable()
        .Scrollable(s => s.Enabled(true).Height("100%"))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Events(events => events.Error("error_handler"))
            .Model(model => model.Id(p => p.IdProjeto))
            .Batch(true)
            .Read("Projeto_Read", "SProjeto")
            .Create("Projeto_Create", "SProjeto")
            .Update("Projeto_Update", "SProjeto")
            .Destroy("Projeto_Destroy", "SProjeto")
            .ServerOperation(false)
        )
    )

I'm with 2012 Q3 version of kendo UI.





1 Answer, 1 is accepted

Sort by
0
Marcos
Top achievements
Rank 1
answered on 22 Feb 2013, 05:39 PM
Hi, I solved the problem using Editor Templates for each field type that i put in grid.

I thought this would be done automatically.

Thank you!
Tags
Grid
Asked by
Marcos
Top achievements
Rank 1
Answers by
Marcos
Top achievements
Rank 1
Share this question
or