We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

RenderAction within DetailsTemplate

Hi,
Is it possible to use Html.RenderAction or Html.RenderPartial within a DetailsTemplate such as:

<script id="tabGridContents" type="text/x-jsrender">
<div>
    @{Html.RenderAction("GetEmployeeDetails", new { id = "{{:EmployeeId}}" });}
</div>
</script>

@(Html.EJ().Grid<EmployeeView>("DetailTemplate") .Datasource((IEnumerable<object>)ViewBag.datasource) .Columns(col =>
col.Field("EmployeeID").HeaderText("Employee ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("FirstName").HeaderText("First Name").Width(100).Add();
col.Field("Title").Width(120).Add();
col.Field("City").Width(100).Add();
col.Field("Country").Width(100).Add();
})
.DetailsTemplate("#tabGridContents")
)


1 Reply

SR Sellappandi Ramu Syncfusion Team April 2, 2015 01:54 PM UTC

Hi Lan Hicks,

Thanks for using Syncfusion products.

Based on your requirement we have created a sample by using Html.RenderPartial. The sample can be downloaded from following location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/118706/DetailsTemplate1914582495.zip

Please refer the following code snippet.

[Grid.cshtml]

@(Html.EJ().Grid<DetailsTemplate.OrdersView>("FlatGrid")

.Datasource((IEnumerable<object>)ViewBag.datasource)

.AllowScrolling()

.AllowPaging() /*Paging Enabled*/

.Columns(col =>

{

})

.DetailsTemplate("#detailGridContents")

.ClientSideEvents(eve => { eve.DetailsDataBound("detailGridData"); })

)

<script src="~/Scripts/jsondata.js"></script>

<script id="detailGridContents" type="text/x-jsrender">

@{Html.RenderPartial("DetailTemplate");}

</script

[DetailTemplate.cshtml]

<div id="gridTab{{:OrderID}}">

<div id="detailGrid">

</div>

</div>

Please try the above sample and let us know if it helps. If we misunderstood your requirements, please provide us clear information. The information provided would be more helpful for us to analyze the issue and provide you the response as early as possible.

Regards,

Sellappandi R


Loader.
Live Chat Icon For mobile
Up arrow icon