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

Error! The requested URL returned 500 - Internal Server Error

1 Answer 568 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 19 Jun 2013, 08:32 AM
Hi all

When I load the page with the following grid, the browser show me this message "Error! The requested URL returned 500 - Internal Server Error"
Could anybody help me please?

That's my code:

(IndexRechte.cshtml)
@(Html.Telerik().Grid<GruppeFunktion>()
   .Name("Grid")
   .DataKeys(keys =>
       {
           keys.Add(o => o.GruppeFunktionID);
       })
   .ToolBar(commands => { commands.SubmitChanges(); })
   .DataBinding(dataBinding =>
           dataBinding.Ajax()
               .Select("_IndexRechte", "Rechte")
               .Update("_SaveBatchEditing", "Rechte")
   )
   .Columns(columns =>
   {
       columns.Bound(o => o.GruppeFunktionID);
       columns.Bound(o => o.visible)
           .ClientTemplate("<#=visible? 'ja' : 'nein' #>")
           .Title("K")
           .Width(12);
   })
 
   .ClientEvents(events => events
       .OnDataBinding("Grid_onDataBinding")
       .OnError("Grid_onError"))
       .Editable(editing => editing.Mode(GridEditMode.InCell))
       .Scrollable(scrolling => scrolling.Enabled(false).Height("auto")) // ohne Scrolling zerfällt die Tabelle, wenn sie zu breit ist
       .TableHtmlAttributes(new { style = "table-layout = fixed" })
       .Resizable(resizing => resizing.Columns(true))
       .Sortable()
       .Filterable()
       .Groupable()
       .Pageable(paging =>
           paging
               .PageSize(ViewBag.PageSize)
               .Style(ViewBag.PageStyle)
               .Position(GridPagerPosition.Bottom)
        )
   )

And that's the Controller:

[GridAction] 
       public ActionResult _IndexRechte()
       {
           List<GruppeFunktion> gruppeFunktion;
 
           gruppeFunktion = (List<GruppeFunktion>)Session["gruppeFunktion"];
 
           // vorbereitete Geschäftsliste anzeigen
           return View(new GridModel<GruppeFunktion> { Data = gruppeFunktion });
       }
 
       public ViewResult IndexRechte(Guid gruppeID)
       {
           // PageSize
           ViewBag.PageSize = PageSizeFunktionliste;
 
           List<GruppeFunktion> gruppeFunktion = (from ObjGF in this.db.GruppeFunktion
                                                  where ObjGF.GruppeID == gruppeID
                                                  select ObjGF).ToList();
           Session["gruppeFunktion"] = gruppeFunktion;
 
           if (gruppeFunktion.ToList().Count > PageSizeFunktionliste)
           {
               ViewBag.PageStyle = GridPagerStyles.NextPreviousAndNumeric;
           }
           else
           {
               ViewBag.PageStyle = GridPagerStyles.Status;
           }
 
           return View();
       }

Thank's a lot!

Marco

1 Answer, 1 is accepted

Sort by
0
Bill
Top achievements
Rank 1
answered on 02 Jul 2013, 07:34 PM
Marco,

I can't tell from the code you provided, but I had this problem and I found that my ViewModel had virtual navigation properties in it that failed the Controller.Json serialization.

I would look here:  GruppeFunktion.

ViewModel properties like this do not appear to play well with Json.

        public virtual Company Company { get; set; }
        public virtual Department Department { get; set; }
        public virtual EmployeeType EmployeeType { get; set; }

Come to think of it, I don't see where you are serializing this as Json.

Good luck.  Hope this helps.
Tags
Grid
Asked by
Marco
Top achievements
Rank 1
Answers by
Bill
Top achievements
Rank 1
Share this question
or