Created
June 27, 2013 14:16
-
-
Save bitsprint/5876779 to your computer and use it in GitHub Desktop.
Control Extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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