Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TabStrip > ajax bound grid in tab strip with load on demand server error 500

Not answered ajax bound grid in tab strip with load on demand server error 500

Feed from this thread
  • Alden avatar

    Posted on Dec 10, 2011 (permalink)

    Hi,

    I have tried to follow the numerous examples of ajax bound grids in tab strips in this forum, but my grid is still not working.  Here is a very simplified version.
    Model:
    public class TaskViewData
       {
           [HiddenInput(DisplayValue = false)]
           public int Id { get; set; }
     
           [Required(AllowEmptyStrings = false, ErrorMessage = "Please enter a task name.")]
           [DisplayName("Task Name")]
           public string Name { get; set; }
     
       }
    Controller:
    public ActionResult Index()
    {
        return View();
    }
     
    [GridAction]
    public ActionResult _AjaxMyTasks()
    {
        return View("_TaskGrid", new GridModel(db.Tasks.Where(t => t.PersonId == me.Id).Select(s => new TaskViewData {
            Id = s.Id,
            Name = s.Name
        })));
    }
     
    public ActionResult MyTasks()
    {
        FillViewBag(); // fill the view bag with stuff we need for editing
        return PartialView("_TaskGrid");
    }
    Index View:
    @{ Html.Telerik().TabStrip()
            .Name("TabStrip")
            .Items(parent => {
                parent.Add()
                    .Text("My Tasks")
                    .Selected(true)
                    .LoadContentFrom("MyTasks", "Tasks");
                parent.Add()
                    .Text("Team Tasks")
                    .LoadContentFrom("TeamTasks", "Tasks");
            })
            .Render();
    }
    _TaskGrid:
    @model IEnumerable<fwf.ViewModels.TaskViewData>
    @using System.Collections
        <div>
        @(Html.Telerik().Grid(Model).Name("TaskGrid")
                    .ToolBar(commands => commands.Insert())
                    .DataKeys(keys => keys.Add(c => c.Id))
            .DataBinding(dataBinding => dataBinding
                  .Ajax().Select("_AjaxMyTasks", "Tasks"))
            .Columns(c =>
            {
                c.Bound(o => o.Name).Width(210);
                c.Command(commands =>
                {
                    commands.Edit();
                    commands.Delete();
                }).Width(200);
            });
    )
    </div>
    What I see is that MyTasks() gets called, but is unable to render the grid, and _AjaxMyTasks is never called.  I receive a server error 500.  I took the advice of this blog post: http://blogs.telerik.com/aspnetmvcteam/posts/10-01-25/resolving-circular-references-when-binding-the-mvc-grid.aspx and created a separate view model, but I still have the same issue.

    What am I missing, here?

    Reply

  • Alden avatar

    Posted on Dec 10, 2011 (permalink)

    Solved.  Firebug revealed a syntax error here:
    .Columns(c =>
    {
        c.Bound(o => o.Name).Width(210);
        c.Command(commands =>
        {
            commands.Edit();
            commands.Delete();
        }).Width(200);
    }); <---- that semicolon is a syntax error
    Lesson -- always use firebug :-)

    Reply

  • Anurag avatar

    Posted on Jul 4, 2012 (permalink)

    I m using the same logic, but it only shows the index view of first tab because its .selected field is true by default. and when i change the controller name of second tab than it works fine. or otherwise if i change the .selected field of second than first index is not working. please help me.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TabStrip > ajax bound grid in tab strip with load on demand server error 500
Related resources for "ajax bound grid in tab strip with load on demand server error 500"

ASP.NET MVC TabStrip Features  |  Documentation  |  Demos  |  Telerik TV ]