Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:47:29+00:00 2026-06-12T07:47:29+00:00

What I’m attempting to do is have a Super entity class for saved products.

  • 0

What I’m attempting to do is have a “Super” entity class for saved products. Depending on where the product is in the application, certain extra attributes are necessary (but not always).

For example, when the product is being used within a grid, I want to have a ViewModel that derives from the Entity (inheriting all of the common fields) and then add a unique identifier attribute like “rowNumber” for easy searching by the kendo ui grid CRUD.

I thought I had all of this working, but I’ve hit a snag… Everything renders fine and operates correctly until I click “save” for the batch grid. It executes the function and all the data is present, but when it returns from the CRUD, it breaks. In firebug, I see that an exception is being thrown, but it never finishes (the ajax spinner stays there) and all information within the exception is empty…

I’m not sure if this is some issue with c# not playing well with CSLA or not. I’m unsure.

Any help would be appreciated! I can’t upload images because my rep isn’t high enough or else I would put a picture of the exception, but I’ll at least put what appears in the Firebug console. Everything else about it is empty though…

Exception with endless execution and no response:

GET http://localhost:32574/Exception/SystemException/00000000-0000-0000-0000-000000000000

Entity:
This file is auto-generated by a CodeSmith template so it is kind of nonsensical, but it holds field values that appear in the view (see below). The exception to what is on the view vs what is in the entity are fields that are not ‘flattened’ in the entity, as Kendo UI does not currently support this inside of editable grids.

ViewModel:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Project.MVC.Models
{
    //The MetaData Class is where to put all annotations and validations
    [MetadataType(typeof(Project.Business.Shipment.ItemMetaDataClass))]
    public class ItemModel : Project.Business.Shipment.Item
    {
        public ItemModel()
        {
        }

        public long rowNumber { get; set; }

        public decimal Length { get; set; }
        public decimal Width { get; set; }
        public decimal Height { get; set; }

        [Display(Name = "UoMDim")]
        [UIHint("ItemGrid_RefUnitOfMeasurementListingDimension")]
        public string DimensionUnitOfMeasure { get; set; }

        [Display(Name = "UoMW")]
        [UIHint("ItemGrid_RefUnitOfMeasurementListingWeight")]
        public string WeightUnitOfMeasure { get; set; }

        [Display(Name = "Weight")]
        public decimal WeightValue { get; set; }

        [Display(Name = "Type")]
        [UIHint("ItemGrid_RefUnitTypeListing")]
        public string QuantityUnitOfMeasure { get; set; }

        [Display(Name = "Units")]
        public decimal QuantityValue { get; set; }
}
}

Grid Controller:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;

namespace Project.MVC.Controllers
{
    [Authorize]
    public class ItemGridController : Csla.Web.Mvc.Controller
    {
        public ActionResult GetProducts([DataSourceRequest]DataSourceRequest request)
        {
            Project.MVC.Models.ShipmentModel shipmentModel = (Project.MVC.Models.ShipmentModel)ControllerBase.State.Object;

            return Json(shipmentModel.ItemModelList.ToDataSourceResult(request));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult CreateProducts([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<Models.ItemModel> itemsToAdd)
        {
            Project.MVC.Models.ShipmentModel shipmentModel = (Project.MVC.Models.ShipmentModel)ControllerBase.State.Object;
            var results = new List<Models.ItemModel>();

            if (ModelState.IsValid)
            {
                foreach (Models.ItemModel newItem in itemsToAdd)
                {

                    if (shipmentModel.ItemModelList.Count > 0)
                    {
                        var nextID = (from i in shipmentModel.ItemModelList
                                      select i.rowNumber).Max() + 1;

                        newItem.rowNumber = nextID;
                    }

                    shipmentModel.ItemModelList.Add(newItem);
                    results.Add(newItem);
                }
            }

            return Json(results.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult UpdateProducts([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<Models.ItemModel> itemsToUpdate)
        {
            Project.MVC.Models.ShipmentModel shipmentModel = (Project.MVC.Models.ShipmentModel)ControllerBase.State.Object;
            var results = new List<Models.ItemModel>();

            foreach (var item in itemsToUpdate)
            {
                Models.ItemModel target = shipmentModel.ItemModelList.Find(i => i.rowNumber == item.rowNumber);
                if (target != null)
                {
                    target = item;
                }
            }

            return Json(ModelState.ToDataSourceResult());
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult DeleteProducts([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<Models.ItemModel> itemsToDelete)
        {
            Project.MVC.Models.ShipmentModel shipmentModel = (Project.MVC.Models.ShipmentModel)ControllerBase.State.Object;

            foreach (var item in itemsToDelete)
            {
                shipmentModel.ItemModelList.Remove(item);
            }

            return Json(ModelState.ToDataSourceResult());
        }
    }
}

View:

@model Project.MVC.Models.ShipmentModel
@using Kendo.Mvc.UI

@(Html.Kendo().Grid<Project.MVC.Models.ItemModel>()
    .Name("QuoteItemGrid")
    .Columns(columns =>
    {
        columns.Bound(i => i.FreightClass)
            .EditorTemplateName("ItemGrid_RefFreightClassListing")
            .Width(50);
        columns.Bound(i => i.Length).Width(30);
        columns.Bound(i => i.Width).Width(30);
        columns.Bound(i => i.Height).Width(30);
        columns.Bound(i => i.DimensionUnitOfMeasure)
            .EditorTemplateName("ItemGrid_RefUnitOfMeasurementListingDimension")
            .Width(50);
        columns.Bound(i => i.QuantityValue).Width(30);
        columns.Bound(i => i.QuantityUnitOfMeasure)
            .EditorTemplateName("ItemGrid_RefUnitTypeListing")
            .Width(50);
        columns.Bound(i => i.WeightValue).Width(30);
        columns.Bound(i => i.WeightUnitOfMeasure)
            .EditorTemplateName("ItemGrid_RefUnitOfMeasurementListingWeight")
            .Width(50);
        columns.Bound(i => i.NmfcCode).Width(50);
        columns.Bound(i => i.ItemDescription).Width(100);
        columns.Command(command =>
        {
            command.Destroy();
        }).Width(60);
    })
    .ToolBar(toolbar =>
    {
        toolbar.Create();
        toolbar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Resizable(resize => resize.Columns(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("QuoteItemGrid_ErrorHandler"))
        .Model(model =>
        {
            model.Id(i => i.rowNumber);
            model.Field(i => i.DimensionUnitOfMeasure).DefaultValue("in");
            model.Field(i => i.WeightUnitOfMeasure).DefaultValue("lbs");
        })
        .Create(create => create.Action("CreateProducts", "ItemGrid"))
        .Read(read => read.Action("GetProducts", "ItemGrid"))
        .Update(update => update.Action("UpdateProducts", "ItemGrid"))
        .Destroy(destroy => destroy.Action("DeleteProducts", "ItemGrid"))
    )
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:47:31+00:00Added an answer on June 12, 2026 at 7:47 am

    From an architectural perspective, my group ultimately thought it unwise to tie our database generated entities so closely to our view. Especially now that the project is being used in multiple places (.Net application, Webservices application, etc…).

    So, in the end we ended up creating ViewModels for each entity so that we could be flexible with our entities across multiple platforms. This restructuring removed the issue above, as the entities are now never present within the view.

    word of caution however: If you’re using Kendo UI, you’ll have to ‘flatten’ your view models that you want presented within a singular component that are deep objects (e.g. object within another object). At the moment, Kendo does not support this. We are using ValueInjecter.

    Hopefully, this information will help someone else too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.