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

Unable to Insert Row using Server Editing

0 Answers 33 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.
Tom
Top achievements
Rank 1
Tom asked on 23 Mar 2011, 01:47 PM
I'm working on my first implementation of your Grid control and I have everything working correctly except for the Insert command.  I'm working from your demo example. My View is 

@model IQueryable<CdDemo.Models.Driver>
 
@{
    ViewBag.Title = "List of Drivers";
}
 
<h2>Index</h2>
<div style="width: 500px">
@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .ToolBar(commands => commands.Insert())
        .DataKeys(keys => keys.Add(c => c.DriverId))
        .DataBinding(dataBinding => dataBinding.Server()
            .Select("Index", "Drivers")
            .Insert("Insert", "Drivers")
            .Update("Save", "Drivers")
            .Delete("Delete", "Drivers"))
        .Columns(columns =>
        {
            columns.Bound(o => o.DriverName).Width(100);
            columns.Bound(o => o.DriverActive).Width(50);
            columns.Command(commands =>
            {
                commands.Edit();
                commands.Delete();
            });
        })
        .Editable(editing => editing.Mode(GridEditMode.PopUp))
        .Sortable()
        .Pageable()
        .Filterable()
)</div>

When I press the Add New Row button, it calls the Index function in the controller -

public ActionResult Index()
{
    IEnumerable<Driver> list = RepositoryContainer.DriverRepository.AllList();
    return View(list);
}

I then get the following error message -

Server Error in '/' Application.

The method or operation is not implemented.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NotImplementedException: The method or operation is not implemented.

Source Error: 

Line 7:  <h2>Index</h2>
Line 8:  <div style="width: 500px">
Line 9:  @(Html.Telerik().Grid(Model)
Line 10:         .Name("Grid")
Line 11:         .ToolBar(commands => commands.Insert())

Source File: c:\Users\Tom\Documents\Visual Studio 2010\Projects\CdDemo\CdDemo\Views\Drivers\Index.cshtml    Line: 

Stack Trace: 

[NotImplementedException: The method or operation is not implemented.]
   Telerik.Web.Mvc.UI.HtmlFragment.AddClass(String[] classes) +54
   Telerik.Web.Mvc.UI.Html.GridEditRowBuilderDecorator.ApplyDecoration(IHtmlNode htmlNode) +88
   Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() +146
   Telerik.Web.Mvc.UI.Html.GridDataSectionBuilder.CreateBody(IEnumerable`1 rowBuilders) +150
   Telerik.Web.Mvc.UI.Html.GridDataSectionBuilder.CreateBody(GridRenderingData renderingData) +263
   Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.CreateBody(GridRenderingData renderingData) +48
   Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.AppendData(IHtmlNode div, GridRenderingData renderingData) +115
   Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.CreateGrid(IDictionary`2 htmlAttributes, GridFunctionalData functionalData, GridRenderingData renderingData) +115
   Telerik.Web.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) +1328
   Telerik.Web.Mvc.UI.ViewComponentBase.ToHtmlString() +121
   Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.ToHtmlString() +56
   Telerik.Web.Mvc.{Dynamic}.GridBuilder`1[[CdDemo.Models.Driver, CdDemo, Version=2011.1.224.0\, Culture=neutral\, PublicKeyToken=null\]\].IHtmlString.ToHtmlString() +30
   System.Web.HttpUtility.HtmlEncode(Object value) +38
   System.Web.WebPages.WebPageBase.Write(Object value) +64
   ASP._Page_Views_Drivers_Index_cshtml.Execute() in c:\Users\Tom\Documents\Visual Studio 2010\Projects\CdDemo\CdDemo\Views\Drivers\Index.cshtml:9
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   System.Web.WebPages.StartPage.RunPage() +19
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +65
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8862461
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Everything I'm doing seems consistent with your examples.  Can you suggestion what I'm doing in error.
Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Share this question
or