如何从MVC 4 Web Grid中的单选按钮字段中选择所选行ID?

时间:2013-12-09 12:06:10

标签: asp.net-mvc-4 razor radio-button webgrid

请帮我从MVC 4 WebGrid的radiobutton字段中选择Selected Row ID?我没有提交表单,而是使用按钮指向同一视图的HTTpGet动作方法。

以下是视图:

var grid = new WebGrid(ViewBag.inCompletePipelines, canPage: true, rowsPerPage: 10,
                            selectionFieldName: "selectedRow", ajaxUpdateContainerId: "inCompletePipelines");
                            grid.Pager(WebGridPagerModes.NextPrevious); 
                            <div id="gridinCompletePipelines" class="gridwidthLong">
                                    @grid.GetHtml(tableStyle: "webGrid",
                                    headerStyle: "header",
                                    alternatingRowStyle: "alt",
                                    selectedRowStyle: "select",




                                    columns: grid.Columns(                                                                            
                                    grid.Column("Name", " Pipeline Name"),
                                    grid.Column("Length", " Length"),
                                    grid.Column("ModifiedDate", "Modified Date"),
                                    grid.Column("ModifiedBy", "Modified By"),
                                    grid.Column(
            header: "Select", 
            format: @<text>@Html.RadioButtonFor(x => x.Id, (int)item.Id)</text>
        )

                                    )) 



@Html.ActionLink("New Pipeline", "pipelines_saved", "PipeLine", new { Id= grid.SelectedRowID ???????? }, new {@class = "roundedButton" }) 

0 个答案:

没有答案