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

[Solved] GridState and AJAX bound client side grids..

0 Answers 86 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.
Jeff
Top achievements
Rank 1
Jeff asked on 14 Nov 2011, 11:12 AM
I have managed to integrate server side binding and GridState

For a server side binding the following syntax works really well
columns.Template(
    @<text>
        <div style="display: none;">@(ViewBag.GridState["sectionID"] = item.SectionID)
        @(ViewBag.GridState["policyZoneID"] = Model.PolicyZoneID)
        @(ViewBag.GridState["policyID"] = Model.PolicyID)
        @(ViewBag.GridState["policyVersion"] = Model.PolicyVersion)
        </div>
        @Html.ActionLink("Edit", "Edit", @item.ControllerName, (RouteValueDictionary)ViewBag.GridState, null)
        @Html.ActionLink("Delete", "Delete", @item.ControllerName, (RouteValueDictionary)ViewBag.GridState, null)
    </text>).Width(40).Title("Commands");

I now need to apply GridState to my client side AJAX bound grids, the current code before for the clientTemplate being
.ClientTemplate(
    @Html.ActionLink("Edit", "Edit", "PolicyZone", new { policyZoneID = "<#= PolicyZoneID #>" }, new { title = "Edit Zone" }).ToHtmlString() + " " +
    @Html.ActionLink("Delete", "Delete", "PolicyZone", new { policyID = "<#= PolicyID #>", policyVersion = "<#= PolicyVersion #>", policyZoneID = "<#= PolicyZoneID #>" }, new { title = "Delete Zone" }).ToHtmlString()
)
.Width(100)
.Title("Commands");

Does anyone know how I can get this to work client side, if I use <@Text>....</@Text> my action links do not render, suppose it would require some OnDataBound event workaround.  or am I just getting the syntax wrong.

Would really appreciate someone could help out with the required @Razor syntax for this, as i would imagine most people would want to have Grid State and not have to roll their own.

Many thanks Jeff.............
Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Share this question
or