在Radiobutton上更改Webgrid内容 [英] Changing Webgrid content on Radiobutton click
本文介绍了在Radiobutton上更改Webgrid内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网格
Hi,
I have a webgrid
@{
var grid = new WebGrid(Model, defaultSort: "UserName", rowsPerPage: 5, canPage: true);
@grid.GetHtml(
columns: grid.Columns(
grid.Column("UserName", "Name", canSort: false),
grid.Column("Address", "Address", canSort: false),
grid.Column("MobileNumber", "MobileNumber", canSort: false),
grid.Column("Gender", "Gender", canSort: false),
grid.Column("", "", format: @<text>@Html.ActionLink("Edit", "../SaveData/Details", new { id = item.UserID })</text>),
grid.Column("", "", format: @<text>@Html.ActionLink("Delete", "Delete", new { id = item.UserID })</text>)
), tableStyle: "list", footerStyle: "foot"
)
}
和一个带有两个值admin和client的radiobutton列表。
当我点击admin radiobutton时,我想用roleid = 2填充webgrid,如果我点击客户端radiobutton我想用roleid = 3填充webgrid。我怎么能这样做。
请帮助我...
and a radiobutton list with two values admin and client.
when i click on admin radiobutton, i want to populate the webgrid with roleid=2 and if i click on client radiobutton i want to populate the webgrid with roleid=3. how can i do that.
please help me...
推荐答案
@using (Html.BeginForm("Action", "Controller", new { id = Model.RadioButtonModelPropert }, FormMethod.Post))
{
//your radio buttons
}
Create Another ActionResult with attribute HttpPost
[HttpPost]
public ActionResult Index(int id)
{
//write the logic for filter the data by id and loaded in to webgrid. the same logic you applied in the httpGet Index action. Only difference is fltering
return View();
}
希望这有帮助
Hope this helps
这篇关于在Radiobutton上更改Webgrid内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文