2

After seeing my question/answer on this topic, finally I decide to put this question,

  1. from Controller side, I am returning a Data Table with dynamic number of columns (not fix at design time, it will give columns at run time).
  2. want to bind that Data Table to jquery grid.

Please suggest and help....

I check this solution, but how to do with MVC?

Is it possible to modify the colModel after data has loaded with jqgrid?

Community
  • 1
  • 1
user584018
  • 10,186
  • 15
  • 74
  • 160

1 Answers1

0

Check this if this will solve your problem. This might be slow but it will work.

 @foreach (System.Data.DataRow row in Model.Table.Rows)
                                        {
                                            <tr>
                                            @foreach (System.Data.DataColumn col in Model.Table.Columns)
                                            {
                                                <td>
                                                    @Model.Table.Rows[row.Table.Rows.IndexOf(row)][col.ColumnName].ToString()
                                                </td>
                                            }
                                            </tr>
                                               }
dineshd87
  • 141
  • 1
  • 2
  • 9