Guest User

Guest User

  • Tech Writer
  • 611
  • 116.5k

Avoid Duplicate value .

Oct 10 2020 2:46 AM
This is my code get subcatgeory Name in list  it's working fie.But i have face a problem showing duplicate value in list
For e.g. Subcategory name Drills -Drills show 5 time . I want to show only once . 
@{ int counter = 0;
foreach (var item in @Model)
{
if (counter == 0)
{
<li role="presentation" class="fs-12"><a href="#" aria-controls="blocking" class="active show" role="tab" data-toggle="tab"> @item.SubCategory </a></li>
}
else
{
<li role="presentation" class="fs-12"><a href="#" aria-controls="blocking" class="show" role="tab" data-toggle="tab"> @item.SubCategory </a></li>
}
counter = counter + 1;
}
}

Answers (3)