I am using MVC Razor View.
At the top of my form I have the following:
@using (Html.BeginForm())
it appears that none of my checkboxes or radiobuttons, or dropdown are working, they are all returning a value of null
checkbox : the model.Domestic is a boolean, could this be an issue? returns null
@Html.CheckBoxFor(model => model.Domestic.Value, new { value = Model.Domestic.Value ? "checked" : "" }) <span class="display-checkbox">Domestic</span>
radio button returns null
@Html.RadioButtonFor(model => model.Subscription_Renewal, false, new { id = "SR_ChkNo", value = "checked", onclick = "checkButtonDt();" }) <span class="largeText_light">N/A</span>
dropdown:
backend code:
// Create the Categories Select List
var categoryList = new List<SelectListItem>();
foreach (Category c in returned.Categories)
{
categoryList.Add(new SelectListItem
{
Value = c.Category_ID.ToString(),
Text = c.Description,
Selected = (c.Category_ID == returned.Category_ID ? true : false)
});
}
returned.CategoryList = categoryList;
then in the View: I tried to select a entry from the selected list, and it returns 0
@Html.DropDownList("category", Model.CategoryList, new { @class = "input-box" })
