Click here to Skip to main content
15,071,729 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am binding a grid in a partial view,But when i do this the whole browser is flicking

This is where i call my Controller

@Html.Action(GridView1Partial)



This is my Controller where i call the view "GridView1Partial"
C#
public ActionResult GridView1Partial()
       {
           var model = db.People;
           return PartialView("_GridView1Partial", model.ToList());
       }


And in _GridView1Partial i have written the code to bind the grid

How can i avoid page flicking by updating just the grid part.I have heard about @Ajax.ActionLink. Can anyone tell me how to implement this.

Thanks in advance
Posted

Hello id-athul;

I have this same issue last Sunday but I realized I didn't add a javascript references to handle that.

Try this in your _Layout view
<script href="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
.

Hope this helps?
   
Hey,

Add the script reference in layout

<script href="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>

And add Ajax.ActionLink as follows in your case.

C#
Ajax.Actionlink("linkText","GridViewPartial","ControllerName",new{},new AjaxOptions(){UpdateTargetId="DivId",InsertionMode = InsertionMode.Replace})


Dam sure this will help. ;)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900