This question is locked. New answers and comments are not allowed.
hi
i have a simple gidview in CustomBinding mode and becuse i use template column i cant use ajax mode.now my prob is that I am unable to get the filtering to work on the Grid.
here is the code :
| <%Html.Telerik().Grid<User>(Model) |
| .Name("Grid") |
| .Columns(columns => |
| { |
| columns.Add(o => |
| { |
| %> |
| <%=Ajax.ActionLink("[Edit]", "OpenIEPanel", new { id = o.ID }, new AjaxOptions { UpdateTargetId = "divIEPanel", OnSuccess = "Dialog.Open" }).Replace("[Edit]", "<img src=\"../../Content/images/edit.png\"/>")%> |
| <% |
| }).Title("Edit").HtmlAttributes(new { @style = "text-align:center" }).Width(75).HeaderHtmlAttributes(new { @style = "text-align: center" }); |
| columns.Add(o => |
| { |
| %> |
| <%= Ajax.ActionLink("[Delete]", "Delete", "Grid", new { id = o.ID }, new AjaxOptions { HttpMethod = "POST", Confirm = "ایا از حذف این ایتم اطمینان دارید." }).Replace("[Delete]", "<img src=\"../../Content/images/delete.png\"/>")%> |
| <% |
| }).Title("Delete").HtmlAttributes(new { @style = "text-align:center" }).Width(75).HeaderHtmlAttributes(new { @style = "text-align: center" }); |
| columns.Add(o => o.Name).HtmlAttributes(new { @style = "text-align:right" }).Width(150).Title("Name").HeaderHtmlAttributes(new { @style = "text-align: center" }); |
| columns.Add(o => o.Family).HtmlAttributes(new { @style = "text-align:right" }).Width(150).Title("Family").HeaderHtmlAttributes(new { @style = "text-align: center" }); |
| columns.Add(o => o.Job).HtmlAttributes(new { @style = "text-align:right" }).Width(150).Title("Job").HeaderHtmlAttributes(new { @style = "text-align: center" }).Filterable(true); |
| columns.Add(o => o.UserName).HtmlAttributes(new { @style = "text-align:right" }).Width(150).Title("UserName").HeaderHtmlAttributes(new { @style = "text-align: center" }); |
| columns.Add(o => o.Password).HtmlAttributes(new { @style = "text-align:right" }).Width(150).Title("Password").HeaderHtmlAttributes(new { @style = "text-align: center" }); |
| }) |
| .ServerBinding(settings => settings.Action("Index", "Grid")) |
| .Pageable(settings => settings.PageSize(5).Total((int)ViewData["total"])).HtmlAttributes(new { @style = "direction:lrt" }) |
| .EnableCustomBinding(true) |
| .Sortable() |
| .Filterable() |
| .Render(); %> |
| public ActionResult Index(GridCommand grid) |
| { |
| return View("Index3", GetData()); |
| } |
| private IEnumerable <User> GetData() |
| { |
| List<User> data = new DBDataContext().Users.Skip(GridHelper.Skip()).Take(GridHelper.PageNumber).MyOrderBy<User>(); |
| ViewData["total"] = new DBDataContext().Users.Count(); |
| return data.AsEnumerable(); |
|
} |