Skip to content

Instantly share code, notes, and snippets.

@thephw
Created April 1, 2014 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thephw/9915234 to your computer and use it in GitHub Desktop.
Save thephw/9915234 to your computer and use it in GitHub Desktop.
public static FieldViewModel GetField(this HtmlHelper<IEnumerable<FieldViewModel>> Html, string fieldId)
{
FieldViewModel field = Html.ViewData.Model.SingleOrDefault(f => f.FieldId == fieldId);
return field;
}
<div class="filter-wrapper">
@{
var fields = Html.GetField("DesignationSK").Items.Select(i => new { i.ID, i.Label });
var fieldsJson = Json.Encode(fields);
}
<label for="group">Group</label>
<input type="text" id="group" data-options='@fieldsJson'>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment