MVC Web 网格提交
我正在尝试使用 WebGrid 来显示一些数据,这很好,但我还想添加一个带有提交按钮的列,该按钮从模型传回 id。这是我的网格代码,
@{var grid = new WebGrid(source: Model);}
<div>
<h2>Multi User Login</h2>
@using (Html.BeginForm())
{
@grid.GetHtml(columns: grid.Columns(
grid.Column("CompanyName"),
grid.Column("Address"),
grid.Column(format: @<input type="submit" name="@item.idAddress" value = "select" />)))
}
</div>
我尝试了多种方法将 idAddress 返回到控制器 post 方法,但没有任何运气。我该怎么做?
I am trying to use a WebGrid to display some data, this is fine but I also want to add a column with a submit button that passes back an id from the model. here is my grid code
@{var grid = new WebGrid(source: Model);}
<div>
<h2>Multi User Login</h2>
@using (Html.BeginForm())
{
@grid.GetHtml(columns: grid.Columns(
grid.Column("CompanyName"),
grid.Column("Address"),
grid.Column(format: @<input type="submit" name="@item.idAddress" value = "select" />)))
}
</div>
I have tried a number of ways to return the idAddress to the controller post method without any luck. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您唯一想要的只是 ID,那么使用 ActionLink 怎么样?
或者你做一个帖子很重要吗?
How about using an ActionLink instead, if the only thing you want is the ID?
Or is it important that you do a POST?