Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
Unable to bind the data to grid
posted

//This is my code inside controller

 private empcontext db = new empcontext();

        //
        // GET: /Employee/
        [GridDataSourceAction]
        public ActionResult Index()
        {
            return View(db.Emps.ToList());
           
        }

//this is my view

 
    @(Html.Infragistics()
                        .Grid<databindingmvc4.Models.Employee>(Model)
                        .ID("grid")
                    .Width("100%")
                    .Height("500px")
                    .PrimaryKey("Id")
                    .AutoGenerateColumns(true)
                    .AutoGenerateLayouts(true)

        .Columns(column =>  
        {  
            column.For(x => x.Id).DataType("int").HeaderText("Id");  
            column.For(x => x.Name).DataType("string").HeaderText("Name");  
            column.For(x => x.Address).DataType("string").HeaderText("Address");  
           
        })
      
        .DataSourceUrl(Url.Action("Index"))  
      
        .DataBind()  
        .Render()  
    )

Thanks,

simpi