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

[Solved] Gridview is returning empty rows

1 Answer 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anjali
Top achievements
Rank 1
Anjali asked on 24 Jan 2011, 10:09 PM
I am not sure what am I doing wrong, but I am not seeing a single row in my grid, the gris is displayed, but there are no rows. Althought I have rows in the database. I have only one table in my LINQ to sql. I just want to display the columns from that table. I have a BindingController and repImportController under controllers. Below is the code for Binding controler and then repImportController

using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Web;
using System.Web.Mvc;
using RepDataImport.Models;
namespace RepDataImport.Controllers
{
    public partial class BindingController : Controller
    {
        //
        // GET: /Binding/
  
  
     
        private static IQueryable<DOWNLOAD_FAILURE> GetFailures()
        {
            repTestDataContext rep = new repTestDataContext();
            return rep.DOWNLOAD_FAILUREs;
  
        }
  
  
    }
}

and repImportController

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RepDataImport.Models;
using Telerik.Web.Mvc;
  
namespace RepDataImport.Controllers
{
    public partial class BindingController : Controller
    {
  
        public ActionResult RepBinding()
        {
            return View();
        }
       
        [GridAction]
        public ActionResult _RepBinding()
        {
             
            return View(new GridModel(GetFailures()));
             
  
  
        }
  
    }
}

My view looks like this

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
  
<%@ Import Namespace="RepDataImport.Models" %>
  
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  
   <%=Html.Telerik().Grid<DOWNLOAD_FAILURE>()
    .Name("Grid")
    .Columns(columns =>
        {
            columns.Bound(d => d.id).Title("ID");
  
        })
        .DataBinding(dataBinding => dataBinding.Ajax().Select("_RepBinding", "Grid"))
        .Sortable()
        .Scrollable()
        .Pageable()
  
    %>
    
  
</asp:Content>

I inlcuded the LINQ assembly in my web.config file.

I am totally stuck. Reviewd my code 5-6 times. Don't know what am I doing wrong.

Any help will be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Anjali
Top achievements
Rank 1
answered on 25 Jan 2011, 04:25 PM
can anyone help me with this please

I really need help on this one.
Tags
Grid
Asked by
Anjali
Top achievements
Rank 1
Answers by
Anjali
Top achievements
Rank 1
Share this question
or