I have an ASP.Net MVC table that I need to highlight certain rows in it when it loads. If the type = chargeback or retroactive then I need to highlight that row. I'm not sure how to go about doing this. I guess you would do the highlighting with Javascript, but how do I check the type in the table and then highlight it?

Here's my table:

<table>
                            <thead>
                                <tr>
                                    <th>Order No.</th>
                                    <th>Type</th>
                                    <th>Price</th>
                                    <th>Reason</th>
                                    <th>Fill Date</th>
                                    <th>Due Date</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var linkedOrder in order.LinkedOrders)
                                {
                                    <tr>
                                        <td>
                                            @if (@linkedOrder.Type == "Spiff")
                                            {
                                                <a onclick="DisplayReceipt('@linkedOrder.OrderNo')">@linkedOrder.OrderNo</a>
                                            }
                                            else
                                            {
                                                @linkedOrder.OrderNo
                                            }

                                        </td>
                                        <td>@linkedOrder.Type</td>
                                        <td>@linkedOrder.Price.ToString("C")</td>
                                        <td>@linkedOrder.Reason</td>
                                        <td>@(linkedOrder.FillDate == null ? "--" : linkedOrder.FillDate.Value.ToShortDateString())</td>
                                        <td>@(linkedOrder.DueDate == null ? "--" : linkedOrder.DueDate.Value.ToShortDateString())</td>
                                    </tr>
                                }
                            </tbody>
                        </table>

Related posts

Recent Viewed