[RESOLVED]How to pass selected rows data of flexi grid to controller.

Hi,

we have a flexi grid in view,need to pass selected rows(check box selected rows) data(it includes two columns data of selected row) to controller.how to achieve this in MVC,

Thanks,

Balu

In your razor view, initiate a form. Then, use a @for loop to write out a table. In the table, each row should represent a view model with a ‘Selected’ property. Then, use @Html.CheckBoxFor(m => Model[i].Selected). When the ‘submit’ button is pressed, the
models will bind back into your controller’s Post action, and you can handle the incoming data appropriately.

<table>
<tr>
  <th>
    Selected
  </th>
  <th>
    Name
  </th>
</tr>
@for( var i = 0; i < Model.Count; i++) 
{
  <tr>
    <td>@Html.CheckBoxFor(m => Model[i].Selected)</td>
    <td>@Html.Name(m => Model[i].Name)</td>
  </tr>
}
</table>

Hi Balu,

For this scenario, you need get the data manually. I suggest that you could use AJAX to submit the data. (read the selected row’s data first)

Best Regards

Starain

Leave a Reply