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
You can still generate column settings for Updating and Hiding features without knowing your model. And the code will be generic.
As for the suggestion. You can log a Ignite UI Product Idea yourself here: http://ideas.infragistics.com/forums/211535-ignite-ui.
Here are the steps to create your idea:
1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).
2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
3. Add your product idea and be sure to be specific and provide as much detail as possible.
• Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!
• Include a link to this thread in your idea so product management will be able to look back at this case.
Best regards,Martin PavlovInfragistics, Inc.
Thank you!
http://ideas.infragistics.com/forums/192360-asp-net/suggestions/17193953-iggrid-model-attributes-for-columns
:)