This question is locked. New answers and comments are not allowed.
I have an action that loads the page with the partial view with a grid and works perfectly even with paging but once I tried to sort it via field the whole thing bombs and just loads the partial view and does not include the master page.
Here's the action:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MySite.UI.Models.FilteredItems>" %>
<%: Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.default.css").Combined(true).Compress(true)) %>
<div class="row">
<% if (Model.Items.Count() == 0) { %>
No nonprofits match that search filter
<% } else { %>
<% Html.Telerik().Grid(Model.Items)
.Name("Companies")
.Columns(col =>
{
col.Template(item =>
col.Bound(item => item.CompanyId).Title("Id");
col.Bound(item => item.Name).Title("Name");
col.Bound(item => item.Country).Title("Country");
})
.Sortable()
.HtmlAttributes(new { style = "width: 100%" })
.Footer(false)
.Render();
%>
</div>
Here's the action:
public ActionResult Edit(){
return View();
}
[HTTPPOST]
public ActionResult Edit(FormCollection formCollection)
{
return View()
}
public ActionResult Index(string filter1, string filter2, string filter3){
return PartialView(new FilteredItems(Context, filter1, filter2, filter3);
}<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MySite.UI.Models.FilteredItems>" %>
<%: Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.default.css").Combined(true).Compress(true)) %>
<div class="row">
<% if (Model.Items.Count() == 0) { %>
No nonprofits match that search filter
<% } else { %>
<% Html.Telerik().Grid(Model.Items)
.Name("Companies")
.Columns(col =>
{
col.Template(item =>
col.Bound(item => item.CompanyId).Title("Id");
col.Bound(item => item.Name).Title("Name");
col.Bound(item => item.Country).Title("Country");
})
.Sortable()
.HtmlAttributes(new { style = "width: 100%" })
.Footer(false)
.Render();
%>
</div>
<%@ Page Title="Select Company" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Select Nonprofit</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <div> <% using (Ajax.BeginForm("Index", new AjaxOptions { HttpMethod = "Get", UpdateTargetId = "Companies" })) { %> <div>filter1</div> <%: Html.TextBox("filter1", "", new { size=40 }) %> <div>filter2</div> <%: Html.TextBox("filter2", "", new { size = 40 }) %> <div>filter3</div> <%: Html.TextBox("filter3", "", new { size = 40 }) %> <div id="CompanyList" style="padding: 10px 0 0 0px;"> <% Html.RenderAction("Index"); %> </div></asp:Content>