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
500
Set HeaderText of igGrid columns when autoGenerateColumns(true) is set.
posted

Hi,

I am using Asp.Net MVC & igGrid with autoGenerateColumns(true) and I am making the GridModel in my Controller's ActionMethod.

Since I have set the autoGenerateColumns(true) I cannot set the headerText on individual columns because they are generated automatically.

The reason I am using autoGenerateColumns(true) is because my grid will show data from different tables dynamically hence the datasource of the grid will change at runtime and I have only 1 ViewPage for the entire grid which gets its gridModel from action method of my controller. My ViewPage(.cshtml) contains only these lines and does not contain anything else, All other settings are written in actionMethod of my Controller.

-------------------------------------------------

ViewPage(.cshtml) for Grid [All the settings are in actionMethod of Cotroller]

@model Infragistics.Web.Mvc.GridModel

@Html.Infragistics().Grid(Model)

-------------------------------------------------

I want to set the HeaderText of my igGrid Columns manually. Initially I wanted to use the DataAnnotations of my model to automatically set them as headerText of the grid columns, but i think thats not a feature of infragistics uptil now, someone told me.

Now I want to iterate through the columns and set the HeaderText manually while autoGenerateColumns is set to true. Can this be done? How do i set the columns headers without explicitly defining every column? 

If it cant be done then please suggest me an alternative.  

How to use C# DataAnnotations to set Headertext or how to iterate through all the columns and set the HeadeText property or any alternative when autogenerateColumns(true) is set..?  If there is no other way than how can i generically specify the columns of grid without writing redundant code for different tables(entities)?