This project is read-only.

How implements paging with a grid into partial view

Oct 22, 2013 at 8:24 PM
Hi I have a grid into a Partial View and this paging not working. What can I do ?
Nov 21, 2013 at 1:55 AM
Hi,

I'm having the same issue. Were you able to resolve?

Thanks in advance
Nov 22, 2013 at 4:31 AM
Hi can you provide your usage and configuration?
Nov 22, 2013 at 12:39 PM
Bukharin wrote:
Hi can you provide your usage and configuration?
See Partial View Code below
@model GA_Access.Models.ClientSearchResultListViewModel
@using GridMvc.Html

 <script src="@Url.Content("~/Scripts/gridmvc.min.js")"></script>
  
@Html.Grid(Model.ClientSearchResultModel).Columns(columns =>
                    {
                        columns.Add().Encoded(false).Sanitized(false).RenderValueAs(c => Html.Raw("<a href='" + Url.RouteUrl("Default", new { Id = c.LeadId, controller = "Client", action = "GetClientInfo" }, "http") + "' ><img align='absmiddle' src='../Content/Images/actionView.gif' border='0' alt='View Details'/></a>")).Titled("");
                        columns.Add().Encoded(false).Sanitized(false).RenderValueAs(c => Html.Raw("<a href='mailto:" + c.EmailAddress + "' ><img align='absmiddle' src='../Content/Images/email_16.gif' border='0'/></a>")).Titled("");
                        columns.Add().Encoded(false).Sanitized(false).RenderValueAs(c => c.HasAppointment ? Html.Raw("<a href='" + Url.RouteUrl("Default", new { Id = c.LeadId, controller = "Client", action = "GetClientInfo" }, "http") + "' ><img align='absmiddle' src='../Content/Images/appicon.gif' border='0' alt='Appointment Details'/></a>") : Html.Raw("")).Titled("");
                        columns.Add().Encoded(false).Sanitized(false).RenderValueAs(c => (c.RetainedLead != null? c.RetainedLead.Trim() != "":true) ? Html.Raw("<img src='../Content/Images/retained.gif' width='16px' border='0'/>") : (c.LeadStatusID == 41 ? Html.Raw("<img alt='Pending Retained' align='absmiddle' width='25px' src='../Content/Images/bullet_blue.png' border='0' />") : Html.Raw(""))).Titled("");
                        columns.Add(c => c.CompanyName).Titled("Company Name").Filterable(false);
                      
                    }).WithPaging(20).Sortable(true)
Calling Page View
@model GA_Access.Models.ClientMainModel

@{
    ViewBag.Title = "Home Page";
}

<script type="text/javascript">
    $(document).ready(function () {


        $("#log").ajaxError(function (event, jqxhr, settings, exception) {
            alert(exception);
        }
        );

        var leadTypeSelected = $("select option:selected").first().val();
        $.get('@Url.Action("_ClientSearchResult")',
                { ClientType: leadTypeSelected}, function (data) {
                    $("#target").html(data);
                });

        $("#LeadType").change(function () {
           
            $("#log").ajaxError(function (event, jqxhr, settings, exception) {
                alert(exception);
            });
          
            var leadTypeSelected = $("select option:selected").first().val();       

            $.get('@Url.Action("_ClientSearchResult")',
                { ClientType: leadTypeSelected }, function (data) {
                    $("#target").html(data);
                });
         
        });
       
       
    });
</script>

<table>
    <tr>
        <td><strong>Client Type: </strong>
           
            @Html.DropDownList("LeadType")
            </td>
        <td></td>
        <td>
td>
        <td>
            
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <div id="log">
            </div>
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <div id="target">
            </div>
        </td>
    </tr>
   
</table>
In My Layout Page, I referenced the following:
 @Scripts.Render("~/Scripts/libs/jquery/jquery.min.js")
<script src="@Url.Content("~/Scripts/gridmvc.min.js")"></script>
I created a separate grid without using the Partial View and it works. I only experience this issue when i'm using the Partial View.
Nov 22, 2013 at 1:42 PM
The Paging Works when I use the following as a test:
@{Html.RenderAction("_ClientSearchResult", "Client", new { ClientType = "A" });}
So it appears that the issue is the jquery.
var leadTypeSelected = $("select option:selected").first().val();       

            $.get('@Url.Action("_ClientSearchResult")',
                { ClientType: leadTypeSelected }, function (data) {
                    $("#target").html(data);
                });