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

grid navigation

0 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
siddharth
Top achievements
Rank 1
siddharth asked on 06 Sep 2012, 01:35 PM
i am not able to move to the next page in my grid my view code is
@(Html.Kendo().Grid<kendoglobalexample.Models.ViewModel.ProgramViewModel>(Model)
    .Name("Grid")
    .HtmlAttributes(new { style = "width: 700px; float: left;" })
    .Columns(columns =>
    {
        columns.Bound(p => p.Progarm1);
       
        
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(220);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    
    .DataSource(dataSource => dataSource
        .Ajax()
        .Events(events => events.Error("error"))
        .ServerOperation(false)
        .Model(model => model.Id(p => p.ProgramId))
        .Create(update => update.Action("Globalization_Create", "Program"))
        .Read(read => read.Action("Globalization_Read", "Program"))
        .Update(update => update.Action("Globalization_Update", "Program"))
        .Destroy(update => update.Action("Globalization_Destroy", "Program"))
    )
)
and my controller code is

 public ActionResult Index()
        {
            return View(ProgramRespository.All());
            
        }
        public ActionResult Globalization_Read([DataSourceRequest] DataSourceRequest request)
        {
            return Json(ProgramRespository.All().ToDataSourceResult(request));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Globalization_Create([DataSourceRequest] DataSourceRequest request, ProgramViewModel product)
        {
            if (product != null && ModelState.IsValid)
            {
                ProgramRespository.Insert(product);
            }

            return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Globalization_Update([DataSourceRequest] DataSourceRequest request, ProgramViewModel product)
        {
            if (product != null && ModelState.IsValid)
            {
                var target = ProgramRespository.One(p => p.ProgramId == product.ProgramId);
                if (target != null)
                {
                    target.Progarm1 = product.Progarm1;
                    
                    ProgramRespository.Update(target);
                }
            }

            return Json(ModelState.ToDataSourceResult());
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Globalization_Destroy([DataSourceRequest] DataSourceRequest request, ProgramViewModel product)
        {
            if (product != null)
            {
                ProgramRespository.Delete(product);
            }

            return Json(ModelState.ToDataSourceResult());
        }
    }
and also i am not able to add nor edit nor delete the data plz can you point out my mistake

No answers yet. Maybe you can help?

Tags
Grid
Asked by
siddharth
Top achievements
Rank 1
Share this question
or