title: MVC3 passing data from jquery modal dialog to controler at load event
body: <p>I'm trying to pass the value of a button to a modal dialog. My button event looks like this: </p>
  
  <pre><code>//Dialog Function=============================================================
      //declaring the function
      $(function () {
          $('#dialog').dialog({
              autoOpen: false,
              hide: 'fade',
              show: 'fade',
              width: 350,
              height: 270,
              resizable: false,
              modal: true,
              dialogClass: 'dialog',
              open: function (event, ui) {               
                  $(this).load('@Url.Action("AddFiles", "ProjectDetails")');
              }
          });
      });
  
      //Showing the dialog when one of the 3 buttons is clicked.
      $("button[name='Add']").click(function () {
          $('#type').val($(this).val());   
          $('#dialog').dialog('open');                 
      });
      //=========================================================================
  </code></pre>
  
  <p>Iim passing the value to a hidden field in my modal div:   </p>
  
  <pre><code>@Html.Hidden("type")
  </code></pre>
  
  <p>So what I need is to turn it into a HiddenFor and for that i need to pass a modelview class
  in my AddFiles method </p>
  
  <pre><code>public ActionResult AddFiles()
      {
          return View();
      }
  </code></pre>
  
  <p>This would be my model: </p>
  
  <pre><code>public class FileViewModel 
  {
      public string Name { get; set; }
     public string type { get; set; }
     public string comments { get; set; }        
   }
  </code></pre>
  
  <p>But I dont know how to assing the value of the button to the model that i would create (the model would have a string type attribute) Is there way to do this or I have no choice that to work with the independent hidden field? </p>