Hi,
I'm using the infragistic grid and creating a generic grid. My problem now is to say to some class attributes to not show or to be hidden. Exemple:
- I have my model
public class CountryModel
{
public int CountryId { get; set; }
public string Code { get; set; }
public string Name { get; set; }
}
- I have my simple grid. Nothing to do here because it will show generically
@model GridModel
@(
Html.Infragistics().Grid("adm-generic-grid", Model)
)
- My datasource is can be a list of Country, Product or anything else. It is IQuerable<object>. So let's say it is something:
gridModel.DataSource = GetCountries();
GetCountries(){
return new List<Countryl>(){
new Country(){} ....
}.AsQueryable()
- It works, I have my grid but I want to hide or show readonly some properties. Do you have some grid attributes for make it possible?
[GridColumn(Readonly=true, Hidden=true)] ????
Hello Cem,
The Grid MVC Wrapper doesn't provide Attributes to show/hide column or to make it read only. You should do this in the GridModel class.
Example:
GridModel gm = new GridModel();
gm.Columns.Add(new GridColumn() { Key = "Column1", Hidden = true });
gm.Features.Add(new GridUpdating() {
ColumnSettings = new List<ColumnUpdatingSetting>() {
new ColumnUpdatingSetting() { ColumnKey = "Column2", ReadOnly = true
});
Hope this helps,Martin PavlovInfragistics, Inc.
Hi Martin,
Thank you for your answer.
That's too bad, actually I'm using a generic grid which take different models, so I can't specify column by column. It would be very nice to have this feature like do the mvc model views then we won't need any column specification. You can maybe create a ticket for this feature and hope to have it in future implementations
Regards