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

RAZOR Page with Kendo Grid

5 Answers 996 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CHARLES
Top achievements
Rank 1
CHARLES asked on 28 Aug 2012, 05:10 PM
Here is my problem, I have a Razor page with a <table>Kendo.Grid</table> tag the page will duplicate my database headers (the first set headers has no data the second set has data) however my page 2 on the grid will pull correct record 11-19 and display them for page 2 so the paging works.  If I remove the <table></table> tag my headers are no longer duplicated however my 2 page does not pull any records and the page number just shows a 0.... has anyone seen this before?
with <table></table>
Header1    Header2    Header3

Header1    Header2    Header3
data            data            data
data            data            data

without <table></table>
Page one
Header1    Header2    Header3
data            data            data
data            data            data        1-10 records

Page2
Header1    Header2    Header3

  • 0 <----page number
no items to display  <---- record text

5 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 29 Aug 2012, 07:32 AM
Hi CHARLES,

I'm afraid that the provided information is not sufficient in order to track the cause for the described behavior. Therefore, could you please provide the Grid declaration as well as the other related information.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
CHARLES
Top achievements
Rank 1
answered on 29 Aug 2012, 12:16 PM
Ok the code to create the grid is for a partialview called _budgetTable

@model IEnumerable<BuyItNow.Models.Bin_BudgetView>
   
      
 @if (Model != null)
{
     <div>

               @(Html.Kendo().Grid(Model).Pageable()
               .Name("kendoGrid")
             

                .Columns(columns =>
                {
                    
                             
                    columns.Bound(p => p.CID).Title("CID").Width(100);
                    columns.Bound(p => p.Engineer).Title("Engineer").Width(250);
                    columns.Bound(p => p.userID).Title("User ID");
                    columns.Bound(p => p.AuthorizedBudget).Format("{0:C}").Title("Authorized Budget");
                    columns.Bound(p => p.BudgetSpent).Format("{0:c3}").Title("Budget Spent");
                    columns.Bound(p => p.AvailableBudget).Format("{0:c3}").Title("Available Budget");
                    columns.Bound(p => p.DateCreated).Title("Date Created");
                    columns.Bound(p => p.DateModified).Title("Date Modified");

                     columns.Bound(p => p.POC).Title("Point of Contact");
                     columns.Bound(p => p.AltPOC).Title("Alternate Point of Contact");

                     columns.Template(@<text>@Html.ActionLink("Edit", "Edit",
                     new { id = @item.ID }, new { @class = "openDialog", data_dialog_id = "editUser", data_dialog_title = "Edit Budget" })</text>).Title("Edit");

                     columns.Template(@<text>@Html.ActionLink("Details", "Detail", new { id = @item.ID },
                     new { @class = "openDialog", data_dialog_id = "detailUser", data_dialog_title = "Budget Details" })</text>).Title("Details");

                     columns.Template(@<text>@Html.ActionLink("Delete", "Delete", new { id = @item.ID },
                     new { @class = "openDialog", data_dialog_id = "deleteUser", data_dialog_title = "Delete Budget" })</text>).Title("Delete");
                })
                       

         )
                       
All is fine when we first load the page. The code in the controller is this and it falls back through here everytime a page is clicked. Problem is no data is displayed when next page is clicked

       public ActionResult Index()
        {
       
            return View(db.Bin_BudgetView.ToList().OrderBy(p=>p.CID));
        }


Any help would be appreciated
0
Rosen
Telerik team
answered on 29 Aug 2012, 02:56 PM
Hi CHARLES,

Unfortunately, I'm unable to recreate such behavior using the provided details. Please find attached, a small test sample which tries to recreate the issue in question. Maybe you can modify this sample to exhibit the issue you are facing and send it back to us for further investigation. 

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
CHARLES
Top achievements
Rank 1
answered on 29 Aug 2012, 03:56 PM
Could the issue be the line of code below?

result.Data = buCtx.binBudget.OrderBy(p => p.Engineer).Take(PAGESIZE).ToList();


This creates a datatable however I do not have IEnumerable or Enumerable implemented.
0
Rosen
Telerik team
answered on 30 Aug 2012, 06:51 AM
Hello CHARLES,

Indeed, such construct can cause this problem as it will always return the first "page" of data.  

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
CHARLES
Top achievements
Rank 1
Answers by
Rosen
Telerik team
CHARLES
Top achievements
Rank 1
Share this question
or