Skip to content

Instantly share code, notes, and snippets.

@bitsprint
Created June 27, 2013 14:16
Show Gist options
  • Select an option

  • Save bitsprint/5876779 to your computer and use it in GitHub Desktop.

Select an option

Save bitsprint/5876779 to your computer and use it in GitHub Desktop.
Control Extensions
namespace Web.Extensions.Control
{
using System.Collections.Generic;
using System.Web.Mvc;
// Usage: foos.Select(x => new SelectListItemWithAttributes
// {
// Attributes = new Dictionary<string, object>() { { "foootherid", x.SomeOtherId } },
// Text = x.Name,
// Value = x.Id.ToString(),
// Selected = x.Id == 1
// }
public class SelectListItemWithAttributes : SelectListItem
{
public IDictionary<string, object> Attributes { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment