J
jc
Sharepoint development.
I've added this inline code block to Sharepoint page.
I know the Web front end where it's running has .NET 3.0
<script runat="server">
protected void Page_PreRender(object sender, EventArgs e)
{
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists["Facilities"];
SPField field = list.Fields["Title"];
List<string> Titles = new List<string>();
foreach(SPListItem spli in list.Items)
{
Titles.Add(spli[field.Id].ToString());
}
Titles.Sort();
Titles.Distinct().ToList().ForEach(delegate(string code)
{
Facilities.Items.Add(new ListItem(code));
});
}
</script>
I'm getting this error:
'System.Collections.Generic.List<string>' does not contain a
definition for 'Distinct'
Thanks for any help or information.
I've added this inline code block to Sharepoint page.
I know the Web front end where it's running has .NET 3.0
<script runat="server">
protected void Page_PreRender(object sender, EventArgs e)
{
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists["Facilities"];
SPField field = list.Fields["Title"];
List<string> Titles = new List<string>();
foreach(SPListItem spli in list.Items)
{
Titles.Add(spli[field.Id].ToString());
}
Titles.Sort();
Titles.Distinct().ToList().ForEach(delegate(string code)
{
Facilities.Items.Add(new ListItem(code));
});
}
</script>
I'm getting this error:
'System.Collections.Generic.List<string>' does not contain a
definition for 'Distinct'
Thanks for any help or information.