HTML data-attributes in WebGrid rows

573 views Asked by At

I have a html <table> built on WebGrid and I would like to have an unique 'data-attribute' value to each row.

Is it possible to include to these 'rows' (<tr>), an "Id" or a custom value?

What i would like to have, is something like this:

<table>
    <tr data-id="customValue"></tr>
    <tr data-id="anyOtherName"></tr>
    <tr data-id="ThirdOptionValue"></tr>
</table>

But i don't know any option from WebGrid to have this kind of result.

One example of what i would like to have (but with WebGrid):

 @foreach (var item in Model)
        {
            <tr data-id="@item.Id">
                <td>...</td>     
            </tr>
        }

Is it possible?

0

There are 0 answers