This question is locked. New answers and comments are not allowed.
When we expand our master row in our Master/Detail grid, we'd like the contents of the detail to pull from a Partial View. To load that Partial View we need to pass in the ID of the master row.
Our grid is bound to a model, so at page load time it populates via Server Binding. However, we want all sorts, etc to use Ajax binding, so we've defined that as well. Because we're using both binding methods, we have to define both a Template and Client template for our detailview.
On page load, if we don't define a client template, the detail content loads great via the Server Binding using this code:
However, if we add this code, it breaks on page load because it appears the Html.Action is executed and the id is not properly passed to the controller in the call to Html.Action (it comes in as null). (Also, If I hardcode the ID it works fine):
I understand that there are inherent differences between Template and ClientTemplate, but I still thought something like this would be possible.
If I wrap the client template in a TabStrip and call the controller via LoadContentFrom it code works fine, but I don't want a tab in the detail view, I just want the HTML from the partial view:
How can I modify the second code block, so it doesn't throw an error on page load when the grid binds server side?
I'm confused as to why the ClientTemplate would even fire on initial page load if it's binding server side initially.
Thanks!
Our grid is bound to a model, so at page load time it populates via Server Binding. However, we want all sorts, etc to use Ajax binding, so we've defined that as well. Because we're using both binding methods, we have to define both a Template and Client template for our detailview.
On page load, if we don't define a client template, the detail content loads great via the Server Binding using this code:
.DetailView(details => details .Template(template => { Html.RenderAction("GridDetail", "Lead", new { id = template.Id }); } ) )However, if we add this code, it breaks on page load because it appears the Html.Action is executed and the id is not properly passed to the controller in the call to Html.Action (it comes in as null). (Also, If I hardcode the ID it works fine):
.DetailView(details => details .ClientTemplate( Html.Action("GridDetail", "Lead", new { id = "<#= Id #>" }).ToHtmlString() ) .Template(template => { Html.RenderAction("GridDetail", "Lead", new { id = template.Id }); } ))I understand that there are inherent differences between Template and ClientTemplate, but I still thought something like this would be possible.
If I wrap the client template in a TabStrip and call the controller via LoadContentFrom it code works fine, but I don't want a tab in the detail view, I just want the HTML from the partial view:
.ClientTemplate( Html.Telerik().TabStrip() .Name("TabStrip_<#=Id#>") .SelectedIndex(0) .HtmlAttributes(new { style = "width: 900px" }) .Items(items => { items.Add().Text("Lead Details").LoadContentFrom("GridDetail", "Lead", new { id = "<#= Id #>" }); }).ToHtmlString())How can I modify the second code block, so it doesn't throw an error on page load when the grid binds server side?
I'm confused as to why the ClientTemplate would even fire on initial page load if it's binding server side initially.
Thanks!