问题描述
我的网络应用程序中有一个GridMvc.Html。
我的需求单击Paging \Sorting功能我希望它能够点击HTTPPOST Action Method。
目前只能点击HTTPGET。
我尝试过使用jQuery,它不起作用我也不确定。
这是我在视图中的网格
@ Html.Grid( Model.SignalDataList).Columns(columns =>
{
columns.Add(s => s.SignalName).Titled(Name);
columns.Add(s = > s.TimeReceived).Titled(Time Received)。Filterable(true);
columns.Add(s => s.Value).Titled(Value)。Filterable(true);
})。WithPaging(10).Sortable(true)
每次点击页面都会转到HTTPGet。所以我通过DropDown选择的数据无法处理
public ActionResult AlarmSignalData()
{
SignalDataRepository signalDb = new SignalDataRepository();
...
尝试
{
GetData();
}
catch(Exception ex){return View(Error,new HandleErrorInfo(ex,SignalData,AlarmSignalData)); }
返回View(signalDataView);
}
但是我希望它能够点击 HttpPost
,coz我想在我的视图中处理trextbox \DropDownlist中的选定数据所以在 HttpPost
我传递我的模型,从哪里可以获取TextBox \DropdownList值来获取过滤数据
[HttpPost]
public ActionResult AlarmSignalData(Model model)
{
SignalDataRepository signalDb = new SignalDataRepository ();
...
尝试
{
GetData(model.SelectSignal,model.FromDate,model,ToData);
}
catch(Exception ex){return View(Error,new HandleErrorInfo(ex,SignalData,AlarmSignalData)); }
返回View(signalDataView);
}
我的尝试:
我已经尝试过使用jQuery,来点击包含Grid MVC的div来处理它不起作用,我也不确定。
I have a GridMvc.Html in my web app.
My Requirement On Click of the Paging\Sorting functionality I want it to hit HTTPPOST Action Method.
Currently it hits only HTTPGET.
I have tried using jQuery, it doesn't work and I am not sure on it too.
This is my Grid in the View
@Html.Grid(Model.SignalDataList).Columns(columns => { columns.Add(s => s.SignalName).Titled("Name"); columns.Add(s => s.TimeReceived).Titled("Time Received").Filterable(true); columns.Add(s => s.Value).Titled("Value").Filterable(true); }).WithPaging(10).Sortable(true)
Each click on page goes to HTTPGet. SO the data I have selected\filtered via DropDown cannot be handled
public ActionResult AlarmSignalData() { SignalDataRepository signalDb = new SignalDataRepository(); ... try { GetData(); } catch(Exception ex) { return View("Error", new HandleErrorInfo(ex, "SignalData", "AlarmSignalData")); } return View(signalDataView); }
But I want it to hit HttpPost
, coz I want to process selected data in trextbox\DropDownlist in my View So in HttpPost
I pass my model, from Where I can take the TextBox\DropdownList values to fetch filtered data
[HttpPost] public ActionResult AlarmSignalData(Model model) { SignalDataRepository signalDb = new SignalDataRepository(); ... try { GetData(model.SelectSignal,model.FromDate,model,ToData); } catch(Exception ex) { return View("Error", new HandleErrorInfo(ex, "SignalData", "AlarmSignalData")); } return View(signalDataView); }
What I have tried:
I have tried using jQuery, to handle via on click of the div which contains the Grid MVC it doesn't work and I am not sure on it too.
Sure... If you can qualify for the Syncfusion Community License[^], then you can get a free commercial-grade Grid[^] plus so much more! ;)
这篇关于Gridmvc.html点击分页或排序以点击HTTPPOST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!