Click here to Skip to main content
15,885,855 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a DataTable object, that i'm using to represent data in a view. The view is generic and therefore i want to just pass in data and display it on the page for all my models (rather than having a different view for each model, when all going to look the same visually).

My problem is, i'm wanting to show the DisplayName attribute value from the model, as the column headers, not the value that comes out of Columns.ColumnName.

i'm currently looping through all the Columns and accessing the ColumnName, is there anyway i can use this column name to find the correct displayName?

I have tried using @Html.DisplayNameFor(m=>m.Columns[i].ColumnName) but didn't work.

Any suggestions would be greatful

ps. before suggestions are made regarding the DB columnnames, these cannot change because they are used for CSV Imports,

Many Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900