avoid the duplicate,only once need to display in mvc
I need to display the testname, if the testname repeats i need not to avoid it?
i used like this but duplicate is displaying.
@{
var tname="null" ;
}
@foreach (StudentGradeBook x in Model.Student)
{
if(!(tname.Equals(@x.TestName)))
{
<th>@x.TestName</th>
}
tname = @x.TestName.ToString();
}
If x contains
test
test
test
testing
testing
But i need to display
test
testing