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
Grid from IGridModel
posted

Hi,

I try to create a Grid by using the IGridModel but I've some trubble to fill this object. What I did is:

Create a custom class which derived from IGridModel

public class CustomGridModel : IGridModel

This gave me a lot of properties to fill but I don't know what property is for what. So what I try is to create a Model:

CustomGridModel model = new CustomGridModel()

{

Columns = new List<GridColumn>()

{

new GridColumn("Col 1", "1", "text 1", "15%"),

new GridColumn("Col 2", "2", "text 2", "15%"),

new GridColumn("Col 3", "3", "text 3", "15%")

}

};

return View(model);

and send it to the view. In the view I want to have one grid which take only this model:

@model IGridModel

@(Html.Infragistics()

.Grid(Model)

)

Is it possible to have something like this? And how I can do it?

Thank you

Parents
No Data
Reply
  • 18204
    Suggested Answer
    Offline posted

    Hello cem ozbas,

    Thank you for posting in our forums!

    I would recommend you derive your class from GridModel instead of IGridModel.  IGridModel is just the interface and would require you to handle all the logic in the igGrid.  If you derive from GridModel, your class will act more like a wrapper than a concrete implementation.

    Then, you can set your DataSource and other options and pass the CustomGridModel to the View.

    I've attached a sample that demonstrates how this can be achieved.  If you need further assistance with this, please let me know.

    igGridModelFromController.zip
Children
No Data