locked
telerik grid ajax binding RRS feed

  • Question

  • User279876185 posted

    hi to all,

    am doing razor mvc3 app. in this am using telerik controls . am binding data to grid usong below code. but events are not firing 

    ...................controler..................


    public ActionResult Index()
    {
    //db.MS_INSURANCE.ToList()
    return View();
    }
    //GET:/Insurance/Create


    [GridAction]
    public ActionResult _AjaxBinding()
    {
    return View(db.MS_INSURANCE.ToList());

    }

    public ActionResult Create()
    {
    return View();
    }
    //POST:/Insurance/Create

    [GridAction]
    public ActionResult Create(MS_INSURANCE msm_insurance)
    {
    if (ModelState.IsValid)
    {
    db.MS_INSURANCE.AddObject(ms_insurance);
    db.SaveChanges();
    return RedirectToAction("Create");
    }
    return View(ms_insurance);

    }

    .....view................

    @(Html.Telerik().Grid(Model)
    .Name("Grid")
    .ToolBar(commands => commands.Insert())
    .DataKeys(keys =>
    keys.Add(c => c.TRANS_NO))
    .Pageable(paging =>
    paging.PageSize(5)
    .Style(GridPagerStyles.NextPreviousAndNumeric)
    .Position(GridPagerPosition.Bottom))
    .Sortable(sorting => sorting
    .SortMode(GridSortMode.MultipleColumn))
    .Columns(columns =>
    {
    columns.Bound(o => o.COMP_NM).Width(100);
    columns.Bound(o => o.DECLARATION_NO).Width(100);
    columns.Bound(o => o.EXPIRY_DT).Format("{0:MM/dd/yyyy}").Width(120);
    columns.Bound(o => o.POLICY_NO);
    columns.Bound(o => o.PREMIUM_AMT).Format("{0:c}");
    columns.Command(commands =>
    {
    commands.Edit();
    commands.Delete();
    });
    })
    .DataBinding(dataBinding => dataBinding.Ajax()
    .Select("_AjaxBinding", "Insurance")
    .Insert("Create", "Insurance")
    .Update("Edit", "Insurance")
    .Delete("Delete", "Insurance")

    but working 


    )
    .ClientEvents(events => events.OnLoad("onLoad"))
    .Editable(editing => editing.Mode(GridEditMode.PopUp))


    )

    ......................

    but data not binding to grid. plz tell me how to do it

    Tuesday, April 17, 2012 8:50 AM

All replies