title: How To Correctly Use the HTML.DropDownList with Ajax Calls for MVC
body: <p>I populated a SelectList Programmatically using the SelectList Constructor (IEnumerable, String, String) </p>
  
  <pre><code>IEnumerable&lt;Permission&gt; ie_SelLstContentAvailPerms; 
  tmpLstPermissions =   FilterAssignablePermissionsByRoleMgblty(p_iRoleId,vmRolePermAdmin.lstPermissionsSource);        
  //test Forcing Results in to IEnumerable format for Select list Constructor 
  ie_SelLstContentAvailPerms = tmpLstPermissions.ToList();
  vmRolePermAdmin.selLstPermissionsSource = new SelectList(ie_SelLstContentAvailPerms, "PermissionId", "Name");
  </code></pre>
  
  <p>And I use the DropDownList structure :</p>
  
  <pre><code>@Html.DropDownList("ddlAssignedRolePermissions", (Model.selLstCurrentRolePermissions), null, new { @id = "ddlAssignedRolePermissions", @size = "5", @onchange = "ddlAssignedRolePermissionsEvent(this)" })
  </code></pre>
  
  <p>My previous use of this structure has an ajax call who's success method is returning the updated model ----but its main body(Postify to AssignPermission(iUserID))is doing the work to the viewmodel based upon the item selected in the drop down list</p>
  
  <pre><code>  $.ajax({
  
              url: "~/../../User/AssignPermission",
              type: "POST",
              data: $.postify({ "p_permId": optionSelectedPerm.value, "p_UserId": iUserId }),
              cache: false,
              success: function () {
                  ReloadUserPermissions();
              },
              error: function () {
                  // alert("FAIL");  //TODO ?
              }
          });
  </code></pre>
  
  <p>I was attempting to replicate this structure for a new page , but instead of using the success results method of the Ajax call I've been trying to return the updated model in the main ajax work..  if the above example were structured this way there would be no success function and the controller ActionResult method would return the updated model.  This isnt working .   I see the data (updated) in the view while debugging but it does not up date the view ...   </p>
  
  <p>Do I have to use the success function of the Ajax call in order to update the view?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
          $(document).ready(function () {
              var optionSelectedPerm;
              var mvcTmpData_iCurrentRoleID;
          });
  
          function SelectedRole(p_lstRole) {
              debugger;
              mvcTmpData_iCurrentRoleID = $("#ddlSelectedRole").val();
              $.ajax({
                  url: "~/../../AdminRoles/AdminRolePermissions",
                  type: "POST",
                  data: $.postify({ "p_nullRoleId": mvcTmpData_iCurrentRoleID }),
                  cache: false,
                  success: function () {
                          AjaxReloadRolePermissions();
                  },
                  error: function () {
  
                  },
              });
  
                function AjaxReloadRolePermissions() {
                  //alert("Current RoleID: " + mvcTmpData_iCurrentRoleID);
  
              var url = '@Url.Action("ReloadRolePermissions", "AdminRoles", new { p_RoleId = "zReplaceRoleId" })';
              window.location.href = url.replace('zReplaceRoleId', mvcTmpData_iCurrentRoleID);
          }
  
          }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Please note that in order to accomplish the first working scenario the controller method as cited in the Ajax call "AssignPermission" is an ActionResult of Type  EmptyResult and marked [HttpPost] so basically it can do work and not worry about a real return. BUT !! the Success function of this same Ajax call  allows me to update the view with the newly adjusted ViewModel.... </p>
  
  <p>My atempt to reproduce my original results is failing I see the model content but it doesnt render in the view </p>