Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
12 Points
20 Posts
Apr 28, 2012 06:12 PM|LINK
This is how i have mine:
Model:
[Required(ErrorMessage = "Whatever you would like.")] public bool? nameOfString { get; set; }
and then in the View:
@Html.DropDownListFor(x => x.ZNameOfString, new[] { new SelectListItem() {Text = "WhateverYouWouldLike", Value = bool.TrueString}, new SelectListItem() {Text = "WhateverYouWouldLike", Value = bool.FalseString} }, "ThisIsWhatTheDefaultValueWillBe")
..Hope this helps
repeater09
Member
12 Points
20 Posts
Re: how to save a item in the database when we select that item from drop down list in mvc3 app
Apr 28, 2012 06:12 PM|LINK
This is how i have mine:
Model:
[Required(ErrorMessage = "Whatever you would like.")] public bool? nameOfString { get; set; }and then in the View:
@Html.DropDownListFor(x => x.ZNameOfString, new[] { new SelectListItem() {Text = "WhateverYouWouldLike", Value = bool.TrueString}, new SelectListItem() {Text = "WhateverYouWouldLike", Value = bool.FalseString} }, "ThisIsWhatTheDefaultValueWillBe")..Hope this helps