This is a migrated thread and some comments may be shown as answers.

Get column names from C# view

3 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 24 Apr 2012, 03:26 PM
Can I use attributes on each property in my C# view (class) and just have the Kendo Grid use that text for the column titles?

Thanks,
Jay

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 25 Apr 2012, 09:57 AM
Hello Jay,

I am afraid I don't understand what exactly are you trying to do and how the Kendo Grid is related to the server-side code. Please clarify.

Generally, the Kendo Grid column titles are either specified explicitly in the widget's initialization script, or rendered in the HTML markup before initializing the widget, or they are autogenerated, based on the field names in the datasource.

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jay
Top achievements
Rank 1
answered on 25 Apr 2012, 03:45 PM
I have an MVC app. I'm converting a list of C# object to JSON and returning the list to the Keno Grid call. One of the properties in my C# class is "ProcuremenetCode." I was hoping to avoid having to explicitly set the column name in the grid to "Procurement Code." I thought maybe I could flag the C# class property with an attribute like [Description("Procurement Code")] and that this would get passed back with the JSON and the Kendo Grid would use that for the column title instead of having to explicitly set the column names in JS.
0
Dimo
Telerik team
answered on 25 Apr 2012, 04:26 PM
Hello Jay,

I am afraid that the server-client integration that you described, does not exist, as Kendo UI is not related to the server platform. You can use two of the three options mentioned earlier.

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Jay
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Jay
Top achievements
Rank 1
Share this question
or