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

[Solved] Sorting and Filtering of Server Edit template

0 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anil
Top achievements
Rank 1
Anil asked on 28 Apr 2011, 04:28 PM
I have a class as follows:
public class RateGroupDTO
    {
        [ScaffoldColumn(false)]
        public int RateGroupId { get; set; }
        public string RateGroupName { get; set; }
    }

and in the Model, I have a property called
[UIHint("RateGroup")]
public RateGroupDTO RateGroupDTO { get; set; }

The display template(~/DisplayTemplates/RateGroup.ascx) is as follows:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BookingEngine.Model.DTO.SearchResults.DTOs.RateGroupDTO>" %>
<%= Html.Encode(Model.RateGroupName) %>

The Editor template(~/EditorTemplates/RateGroup.ascx) is a s follows:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BookingEngine.Model.DTO.SearchResults.DTOs.RateGroupDTO>" %>
<%  if(Model != null ){ %>
<%= Html.Telerik().DropDownList()
        .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
                    .BindTo(new SelectList((IEnumerable)ViewData["RateGroupsDTOs"], "RateGroupId", "RateGroupName",
                Model.RateGroupId.ToString()))
%>
<%} else{%>
<%= Html.Telerik().DropDownList()
        .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
                    .BindTo(new SelectList((IEnumerable)ViewData["RateGroupsDTOs"], "RateGroupId", "RateGroupName"))
 %>               
<% } %>

and in the view, I have a grid with following column :
columns.Bound(p => p.RateGroupDTO).Width(70).Title("Rate<br/>Group<br/>Name");

The sorting and filtering are enabled for the grid, but the filtering box for this column(RateGroupDTO) is all emtpy. Also, the sorting on this column throws an error.

Please let us know how to make sorting and filtering  work for this column with server edit template.
Tags
Grid
Asked by
Anil
Top achievements
Rank 1
Share this question
or