Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
2320 Points
595 Posts
Jun 03, 2012 09:37 AM|LINK
Hi
Try this:
return View(ts.AsEnumerable());
or like this:
public ActionResult Index() { IEnumerable<SelectListItem> ts = (from s in Enumerable.Range(1, 10) select new SelectListItem { Text = s.ToString(), Value = s.ToString(), }); ts.First().Selected = true; return View(ts); }
Hope it can help.
jsiahaan
Contributor
2320 Points
595 Posts
Re: Why it cannot work property without "ToList"?
Jun 03, 2012 09:37 AM|LINK
Hi
Try this:
or like this:
public ActionResult Index() { IEnumerable<SelectListItem> ts = (from s in Enumerable.Range(1, 10) select new SelectListItem { Text = s.ToString(), Value = s.ToString(), }); ts.First().Selected = true; return View(ts); }Hope it can help.
Indonesian Humanitarian Foundation