Posts

Showing posts with the label WebGrid

Donate

ASP.NET MVC WebGrid In Partial View Redirects To Blank Page During Pagination

Image
Hello, I've created an ASP.NET MVC website that loads a partial view with a WebGrid control on ajax call. When I tested navigating to next record set, the WebGrid performs a postback and then redirects to a blank page. Not only that, the WebGrid control also lost it's css style. After doing some research on it's properties, I basically encountered a property called ajaxUpdateContainerId . After including that property in the WebGrid control, the pagination works fine and does not redirect to a blank page. Original Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 @{ var grid = new WebGrid( canPage: true, canSort: true, rowsPerPage: 10); grid.Bind(Model.AddressList, rowCount: Model.AddressList.ToList().Count); grid.Pager(WebGridPagerModes.NextPrevious); @grid.GetHtml(tableStyle: "webGrid", htmlAttributes: new { id = "grid" }, headerStyle: "hea

Render ASP.NET MVC 4 Partial View Based From Html.DropdownList() Selected Value Using jQuery

Image
In my previous post on loading items to Select control, I decided to create a more advanced example by rendering an asp.net mvc partial view using jquery based on drop down selection. The mvc application will simply load all orders irregardless of the status made by a particular customer selected from the dropdown list. The application also calculates the total orders made by the customer using jquery numberformatter framework. Partial View: @model IList <ShowWebGridUsingJQuery.Models.SalesOrderHeader> @{ Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_Layout.cshtml"; } @{ var orderTotal = Model.Sum(o => (float)o.TotalDue); WebGrid grid = new WebGrid(Model); } <script type= "text/javascript" > $(document).ready(function () { var total = 0; $('#divGrid .totalDue').each(function () { total = total + parseFloat($(this)[0].innerHTML.toLocaleString().replace(",", &q

Donate