Skip to content
Loading
Dropdownlist with JQuery using If Condition  
  •                   
  •   
  •                 class="form-group">  
  •                     @Html.LabelFor(model => model.ATTNSYSID, "Operator Name", htmlAttributes: new { @class = "control-label col-md-2" })  
  •                     class="col-md-10">  
  •                         @*@Html.TextBoxFor(model => model.ATTNSYSID, new { id = "txtUserSearch", @class = "form-control" })*@  
  •                         @*@Html.DropDownListFor(model => model.ATTNSYSID, new SelectList(""), "--Select Operator--"new { @class = "form-control" })*@  
  •                         @Html.DropDownList("ATTNSYSID"null, htmlAttributes: new { @class = "form-control" })  
  •                         @Html.ValidationMessageFor(model => model.ATTNSYSID, ""new { @class = "text-danger" })  
  •                       
  •                   
  •   
  •                 class="form-group">  
  •                     @Html.LabelFor(model => model.Status, "Status", htmlAttributes: new { @class = "control-label col-md-2" })  
  •                     class="col-md-10">  
  •                         @Html.EditorFor(model => model.Status, new { htmlAttributes = new { @class = "form-control" } })  
  •                         @Html.ValidationMessageFor(model => model.Status, ""new { @class = "text-danger" })  
  •                       
  •                   
  •   
  •   
  •                 class="form-group">  
  •                     @Html.LabelFor(model => model.NextStageID, "Next Production Stage", htmlAttributes: new { @class = "control-label col-md-2" })  
  •                     class="col-md-10">  
  •                         @if (ViewBag.StageID != null)  
  •                         {  
  •                             @Html.DropDownListFor(model => model.NextStageID, ViewBag.StageID as SelectList, "-----Select Stage ID---"new { @class = "form-control" })  
  •                         }  
  •                         @*@Html.DropDownList("NextStageID"null, htmlAttributes: new { @class = "form-control" })  
  •                         @Html.DropDownListFor(model => model.NextStageID, ViewBag.NextStageList as SelectList, "-----Select Next Stage ID---"new { @class = "form-control" })*@  
  •                         @Html.ValidationMessageFor(model => model.NextStageID, ""new { @class = "text-danger" })  
  •                       
  •                   
  •                 class="dropdown-menu">  
  •                 class="form-group">  
  •                     class="col-md-offset-2 col-md-10">  
  •                         "submit" value="Create" class="btn btn-default" />  
  •                       
  •                   
  •               
  •         }  
  •   
  •         
      
  •             @Html.ActionLink("Back to List""Index")  
  •           
  •       
  •   
  •  
  •  

    1 Reply

    Know the answer? Post it — somebody with the same question will find it here.