I have a following razor to create a table.
@model IEnumerable<iBoxV5.Model.Common.AdvancedSearch>
<table id="SearchFieldsTable">
<thead>
<tr>
<th>
ColumnName
</th>
<th>
FilterValues
</th>
<th>Updated Before</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr [email protected] [email protected] [email protected] [email protected] id=@(index++)>
<td>
@Html.DisplayFor(modelItem => item.ColumnName)
</td>
<td>
@Html.TextBoxFor(modelItem => item.FilterValue, new { @class = "FrmTextBox advSearch" });
@Html.TextBoxFor(modelItem => item.FilterValue, new { @class = "FrmTextBox advSearch" });
</td>
<td>
@Html.TextBoxFor(modelItem => item.FilterValueTo, new { @class = "FrmTextBox advSearch" });
</td>
</tr>
}
</tbody>
</table>
And In the above I have added few attributes for the like ColumnName.
I wants to build a JSON for the each row of the Table.
I tried with the following jquery Snippet.
var SearchFieldsTable = $("#SearchFieldsTable tbody");
var trows = SearchFieldsTable[0].rows;
$.each(trows, function (index, row) {
var ColumnName=$(row).attr("ColumnName");
});
But the above is not returning the ColumnName I expected.