Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Generic Grid
posted

Hi,

I try to create a generic grid which will map severals tables and I'll be able to modify the content of those table by only one grid but I've some trubble.

Idea is having only one grid which will take an object like and load all the porperties automatically. We will be able to save data by save button. I took the example you have in your website which is Basic Edit of grid.

I prepared an example at I join it to you with this mail. You have only two pages

HomeController:

  public ActionResult SaveGenericData()

This function save the data modified in grid, this I want to it in a generic way

public ActionResult GetGenericData()

This function send a Queryable object, this method I would send a generic data

Index.html:

You will find the grid:

@model IQueryable<TestCountry>

this I want it to take a generic object

@(Html.Infragistics()

.Grid(Model)

.ID("Grid")

.PrimaryKey("CountryId")

Here it takes a primary key, it should be a dynamic key calculated from generic class

Thank you for your help

infragistic_generic_grid.zip
Parents
No Data
Reply
  • 18204
    Offline posted

    Hello cem ozbas,

    Thank you for posting in our forums!

    I recommend using the MVC ViewBag to achieve this.  You can assign the values you want to reference in the View from the Controller.

    This lets you do something like:

    HomeController.cs:

    ViewBag.GridPK = "CountryId";

    Index.cshtml:

    @(Html.Infragistics()
        .Grid(Model)
        .ID("Grid")
        .PrimaryKey(ViewBag.GridPK)

    If you have any further questions or concerns with this, please let me know.

Children