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

  • Home
  • SEARCH
  • 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 8893239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:11:45+00:00 2026-06-14T23:11:45+00:00

I currently have 2 classes that inherit a base BaseGridRowModel, eg: PersonRowModel CityRowModel I

  • 0

I currently have 2 classes that inherit a base BaseGridRowModel, eg:

  • PersonRowModel
  • CityRowModel

I have created a controller which accepts the base as input, and pushes it the cache for use later.

   [HttpPost]
   public ActionResult RowCheckedStatusChanged(BaseGridRowModel row)
   {
       try
       {

I then call the method, pushing the grid row to the controller in an ajax call.

       $.ajax({
           type: 'POST',
           url: "/Central/MyGrid/RowCheckedStatusChanged",
           data: rowData.toJSON(),
           cache: false,

However all the extra fields are lost since are not part of the base. This always becomes null and throws an exception.

          var rowData = (row as PersonRowModel);
          if (rowData == null)
          {
             throw new Exception("Row must inherit BaseGridRowModel.");
          }

I need these fields later for picking back out of the cache. Is there any way to save them?

Thanks

  • 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-14T23:11:47+00:00Added an answer on June 14, 2026 at 11:11 pm

    The problem is the model binder is binding your data to the BaseGridRowModel. Essentially it is deserializing the posted data into a BaseGridRowModel.

    So the model binder isn’t smart enough to recognized the extra fields and magically determine there is a class that inherits from the one in the action and use that instead.

    You would think you could create overloads for the various types if you want that data and then funnel it down into the generic version but I believe that wouldn’t work either. You could create your own custom model binder that would look for the extra data and create the correct type then effectively upcast it to BaseGridRowModel

    Alternatively you could just look in HttpContext.Current.Request.Form to get the extra fields. Or you could add the fields to the method… ie…

    public ActionResult RowCheckedStatusChanged(BaseGridRowModel row, string otherdataItem1, string otherdataItem2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Parser classes that inherit from a base class, BaseParser. I want
I currently have service classes that look something like this public class UserService :
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have four classes which share some arrangement of four properties. I have currently
Currently I have a DataModel object which contains my linq to sql classes(a dmbl
I have a common base class from which all my ASMX webservice classes will
I currently have three classes User , UserProfile , and Vendor . User is
I currently have 2 concrete methods in 2 abstract classes. One class contains the
I'm currently using the hilo id generator for my classes but have just been
I'm currently using QDataStream to serialize my classes. I have quite a few number

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.