'colouring rows based on id of model
i want unique color to the table rows to identify all records of that InternalTaskID (which can be taken from Model) currently I'm doing this...
@{
var rowColor = "#dfd6fa";
}
@foreach (var item in Model)
{
if(item.InternalTaskID.Equals(Unique_TaskIDs.First()))
{
rowColor = "#dfd6fa";
}
else
{
rowColor = "#ffffff";
}
<tr style="background-color:@rowColor;">
...
...
</tr>
}
but this will work only for rows with the same first id, currently i need to know
- How to get unlimited supply of unique colours and use them without repetition
- assigning these colors to the Unique_ids
- combine Unique_ids and unique_colors to get the required View
how do i do it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
