@model GreenTree.Nachtragsmanagement.Web.Models.Appendix.IRequireStateDataModel @{ var comboBoxSettingsAction = (Action)Session[ViewData["StatesComboBoxSettings"].ToString()]; var stateValue = (Model == null || (Model != null && Model.StateId == -1) || (Model != null && !Model.StateId.HasValue)) ? Convert.ToInt32(ViewData["DefaultState"]) : Model.StateId; } @if (Model == null) { Html.DevExpress().ComboBox(comboBoxSettingsAction) .BindList(ViewData["AllStates"]).Bind(stateValue).GetHtml(); } else { Html.DevExpress().ComboBoxFor(m => m.StateId, comboBoxSettingsAction) .BindList(ViewData["AllStates"]).Bind(stateValue).GetHtml(); }