如何根据选定的ID将网格视图数据传递到另一个视图

时间:2015-06-03 07:46:21

标签: asp.net-mvc-3 asp.net-mvc-4 webgrid

//this is my web grid

using (Html.BeginForm())
{
    <div id="content">
        @grid.GetHtml(
          tableStyle: "webgrid-table",
          headerStyle: "webgrid-header",
          footerStyle: "webgrid-footer",//properties
          alternatingRowStyle: "webgrid-alternating-row",//this are the 
          rowStyle: "webgrid-row-style",
          columns: grid.Columns(
              grid.Column(header: "job_id", format: @<text><div>@(item.WebGrid.Rows.IndexOf(item) + 1)</div></text>),
              grid.Column(columnName: "location", header: "location"),
              grid.Column(columnName: "jobtitle", header: "jobtitle"),
              grid.Column(columnName: "technology", header: "technology"),
              grid.Column(columnName: "job_description", header: "job_description"),
              grid.Column(columnName: "category", header: "category"),
              //this is link for navigating to next page with selected id                                                 
              grid.Column(columnName: "Apply",format:@<text>@Html.ActionLink("Apply", "JobDetails", "Client")</text>)
         ))
    </div>
}

1 个答案:

答案 0 :(得分:0)

如果我理解你的问题,那么这可能会有所帮助:

将网格组件提取到局部视图,然后可以在任何地方重复使用。

如果您的意思是仅提取数据,那么您必须使用jQuery ajax来获取感兴趣的数据。