I'm very new to .Net C# and I really don't have a clue as to what I'm doing wrong. I have a LinqToSql DataContext I'm drawing distinct results from, but I'm not sure how to properly output the results in my view. I'm getting a compilation error (Compiler Error Message: CS1002: ; expected)
on my view.
StoreRepository.cs
public IQueryable<String> GetStoreStates()
{
return from Store in db.Stores
orderby Store.State
select Convert.ToString(Store.State.Distinct());
}
StoresController.cs
public ActionResult StatesIndex()
{
var states = repo.GetStoreStates().ToList();
return View("StatesIndex", states);
}
StatesIndex.aspx
<ul>
<% foreach (var state in Model)
{ %>
<li>
<% Html.Encode(state) %>
</li>
<% } %>
</ul>