The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
When developing web application, we have a form to enter selection criteria, then click the Query button on form to submit the criteria, in MVC mode, another action will handle this request and regenerate the content of grid,
[AcceptVerbs(HttpVerbs.Post)] public ActionResult ShowGridActionX(string objNum) { DataModel model = new DataModel(); IList result = model.GetData(objNum); return result.GridActions(); }
How do I simulate the post to this action and refresh the content of grid?
BKBalaji K Syncfusion Team July 28, 2009 03:06 PM UTC
Hi Mac,
Thank you for using Syncfusion products.
We can use the same form post in MVC.Please find the code snippet illustrating that.
[ASPX] <% using (Html.BeginForm("ShowGridActionX","ControllerName")) { %> <%=Html.TextBox("objNum") %> <%=Html.Grid("Grid1")%>
<% } %>
[Controller] [AcceptVerbs(HttpVerbs.Post)] public ActionResult ShowGridActionX(string objNum) { DataModel model = new DataModel(); IList result = model.GetData(objNum); return result.GridActions(); }
Let us know if you have any issues.
Regards, Balaji.
MLmac leeJuly 29, 2009 10:02 AM UTC
Not really.
I hope, 1. using Ajax when post back. 2. get the data entered in the form as parameter for controller.
If the grid has additional functionality to post back data in the form and refresh function, it is more usefull in real world application programming; otherwise, the sorting/paging/grouping function cannot working properly.
I've wrote a Javascript to do refrshing thru simulate the sorting postback when click a button on the form:
var f2 = $(formID).formToArray(); // Merge form data into PagingParams var p1 = $.param(PagingParams); var p2 = $.param(f2); p1 = p1 + (p2 ? "&" : "") + p2; grid._sendHtmlActionRequest(p1, "sorting", grid.get_ServerModePagingSortingMapper());
this is what I can do to bind data for grid when postback, but lost paging/sorting/grouping functions of grid cause no form data was posted back to controller.
BKBalaji K Syncfusion Team July 30, 2009 06:49 AM UTC
Hi Mac
Please find the code snippet to refresh the grid's content.