c# - Telerik mvc grid, Model Field to db field name relation -
i have telerik mvc grid. trying sorting work. binding grid model collection. model has different names fields data layer.
when click sort button grid passes sort column name property name model binding. want set different name, have match data access layer. have done adding attribute properties of model specify related database field names. there similar in telerik's grid?
have tried [column(name = "myname")]
but seems ignored.
not want configure grid in way know these names. ui layer should not aware of db layer's field names. there way can set within model?
i not sure if understand trying do. example code help. being said try answer question. override name in method on controller using sort telerik grid. have same situation , don't have problem sorting. binding grid directly model , doesn't access data access logic @ all. telerik grid uses linq should sorting on collection , not have reconnect data access logic. have included example of controller method calling when doing sorting on telerik grid. orderbll.getall returns collection of orders.
[gridaction] public actionresult ajaxindex() { // of orders return view(new gridmodel(orderbll.getall())); }
Comments
Post a Comment