Skip to content

Instantly share code, notes, and snippets.

@saad749
Created February 2, 2017 05:56
Show Gist options
  • Save saad749/db606466725cff8f96b5a766da4a4dad to your computer and use it in GitHub Desktop.
Save saad749/db606466725cff8f96b5a766da4a4dad to your computer and use it in GitHub Desktop.
Using @: to append options with list from Server Side (Razor Syntax)
.append($("<option>", { "text": "-Please Select-" }))
@foreach (var item in Model.XXX)
{
@: .append($("<option>", { "text": "@item.Title", "value": @item.Id }))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment