Please check following code that i am using for Dropdown List bind after split the values in Partial View and in bind dropdownlist i am getting repeated values thats why i want to remove duplicate value in same.
Please suggest .
Partial View Code :-
foreach (var deposit in Model.Children())
{
<div class="content" style="width: 100% !important;">
<header>
<h3><a href="@deposit.GetProperty("depositRateFile").Value()" target="_blank">@deposit.Name</a></h3>
</header>
</div>
string[] categories = deposit.GetProperty("depositRateDate").Value().ToString().Split('/');
var day = categories[0].ToString();
var month = categories[1].ToString();
var year = categories[2].ToString();
var deposityear = year.Split(' ');
<option>@deposityear[0].ToString()</option>
How to remove duplicate value in Umbraco V8
Please check following code that i am using for Dropdown List bind after split the values in Partial View and in bind dropdownlist i am getting repeated values thats why i want to remove duplicate value in same. Please suggest .
Partial View Code :-
foreach (var deposit in Model.Children()) {
====================================== Output :-
Hi Noor,
Can you try var deposityear = year.Split(' ').Distinct();
Regards,
Shaishav
Getting attached error. Please suggest.
Try depositYear.elementAt(0)
but its not removed duplicate values
I have modify the code as below but not getting distinct value and debug mode as attached screen shot i achieve objective . Please suggest.
List
=====================================
getting output :
(System.Linq.Enumerable+
============= screen shot getting debug ======================
is working on a reply...