Skip to content
Loading
Base dropdownlist of a viewbag value  
  • class="row">  
  • class="col-lg-11">  
  • class="input-group">  
  • class="input-group-addon">  
  • class="glyphicon glyphicon-user">  
  • @Html.DropDownListFor(x => x.Hospital,  
  • new SelectList(string.Empty, "Value""Text"),  
  • "Please select a Hospital"new { @class = "form-control" })  
  •   
  •   
  •   
  • }  
  • 0
  • hi yes so the viewbag will just have   a 3 or 4 etc in depending on the site, i have got this value from the active directory.
    I then need a dropdown list that will be defaulted to the viewbag results as a description so in this instance 3 = "A".  the dropdownlist result needs to be binded to the Hospital in a textboxFor and the user needs to be able to override the defaulted selection with other options as well
     
    Thank you for your reply, i hope i have explained well enough. 
    0
  • Joginder Banger
    Hi Michelle M,
     
    I little query about to where is store data and stored data is globally. 
     
    Please correct me if am take wrong direction. As per my understanding you need to a store data in object after page ready. 
     
    I assume in object have couple of data.
    1. var person = {  
    2.   Site: "3",  
    3.   lastName: "Doe",  
    4.   age: 50,  
    5.   eyeColor: "blue"  
    6. };  
    before call just check dropdown selected value is there or not.
     
    Waiting 
     
    Thanks
    Joginder signh  
    0