title: It is possible to refresh ViewBag value in the view?
body: <p>I'm trying to do a dynamic dropdownlist :
  I get the options of the dropdownlist from a database and put them in an objects list. In accordance with a checkbox value i remove objects from the list and set this list as a ViewBag value.</p>
  
  <pre><code>public ActionResult ThematicManagement(string Id, string IsAdult, string flagAdult)
               {
                  .....
                  ViewBag.DDL = null;      
  
                  var response = VodCatalogBUS.GetParentThematics(); 
                  List&lt;oboThematic&gt; list = new List&lt;oboThematic&gt;();
                  list = response.Data;
                  if (IsAdult == null || IsAdult == "false")            
                      list.RemoveAll(x =&gt; x.IsAdult == true &amp;&amp; x.Id != 1007);           
                  else 
                      list.RemoveAll(x =&gt; x.IsAdult == false &amp;&amp; x.Id != 1007);                
  
                  ViewBag.DDL = new SelectList(list, "Id", "Name");
                  ....   
  </code></pre>
  
  <p>Then in my view i fill the dropdownlist like that :</p>
  
  <pre><code> @Html.DropDownList("ParentThematic", (SelectList)ViewBag.DDL, new { @class="dropdown" })    
  
  &lt;label&gt;&lt;input type="checkbox" value="" id="ChkIsAdult" name="ChkIsAdult"&gt;Adulte&lt;/label&gt;
  </code></pre>
  
  <p>There is no problems here, i obtain the dropdown list with 4 options after the RemoveAll in the controller. Then if i click the checkbox, i must obtain 3 other options.</p>
  
  <p>So I use an ajax call to return into the controller in the aim to update Viewbag's value :</p>
  
  <pre><code> $('#ChkIsAdult').change(function () {                 
                  var IsAdult = $('#ChkIsAdult').is(':checked');
                  var url = dev + "/Legacy/ThematicManagement";
                  $.ajax({
                      url: url,
                      cache: false,
                      type: 'POST',
                      data: {                        
                          IsAdult: IsAdult,
                          flagAdult : 'true',
                      },
                      success: function () {
                          alert('test');
                      }
                  });               
              })
  </code></pre>
  
  <p>It works i return into the controller, but i think that the view isn't refresh so i retreive the old values (the 4 options) of the dropdownlist after clicking the checkbox.</p>
  
  <p>I also try with ViewData and TempData to replace ViewBag but i've always the same proprem !</p>
  
  <p>According to you, it is the good solution ? Can it works ? </p>