title: Hidden Field value is showing undefined
body: <p>I have simple asp.net async upload where I'm trying to upload a sample image from my local system and upon uploading trying to perform a simple webmethod.</p>
  
  <p>Scenanrio:</p>
  
  <ol>
  <li><p>Uploading image using async uploader and its working fine and uploading it to dest folder.</p></li>
  <li><p>Now when trying to save the fileupload.filename in  hidden field and tested if its really getting the filename(This also works)</p></li>
  <li><p>Now when trying to send the var where the value of hidden field is saved comes the problem.
  Here it is showing me as undefined.</p></li>
  </ol>
  
  <p>Here is my code:</p>
  
  <pre><code>Protected Sub fileUploadComplete(ByVal sender As Object, ByVal e As AsyncFileUploadEventArgs)
      Thread.Sleep(1000)
      Dim filename As String = System.IO.Path.GetFileName(fileUpload1.FileName)
      fileUpload1.SaveAs(Server.MapPath("UploadFiles/") &amp; RandomFolder.Value &amp; "/" &amp; filename)
      lblFilename.Value = filename
  End Sub
  
  Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
      If Not IsPostBack Then
          CreateFolder()
      End If
      Dim mypath As String = Server.MapPath("~/UploadFiles/")
      myFilePath.Value = mypath
  
  End Sub
  &lt;WebMethod()&gt; _
  </code></pre>
  
  <p>
      Public Function FileDetails(ByVal Filename As String, ByVal mypath As String) As String
        //Some operations
          Return "True"
      End Function</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
             &lt;link href="style/bootstrap.css" rel="stylesheet" /&gt;
      &lt;script src="http://code.jquery.com/jquery-1.11.0.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      // This function will execute after file uploaded successfully
      function uploadComplete() {
          document.getElementById('&lt;%=lblMsg.ClientID %&gt;').innerHTML = "File Uploaded Successfully";
  }
  // This function will execute if file upload fails
  function uploadError() {
      document.getElementById('&lt;%=lblMsg.ClientID %&gt;').innerHTML = "File upload Failed.";
  }
  
  $(document).ready(function () {
      $("#btnconvert").click(function () {
          var FileFolder = $('#RandomFolder').val();
          var filename = document.getElementById('&lt;%=lblFilename.ClientID %&gt;').val();
          alert(FileFolder);
          alert(filename);
          $.ajax({
              type: "POST",
              url: "AsyncUpload.aspx/FileDetails",
              data: JSON.stringify('{"Filename":"' + filename + '","mypath":"' + FileFolder + '"}'),
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              success: function (msg) {
                  // Replace the div's content with the page method's return.
                  alert("Success");
              }
          });
      });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
      &lt;asp:ToolkitScriptManager ID="scriptManager1" runat="server"/&gt;
  &lt;div&gt;
  &lt;asp:AsyncFileUpload ID="fileUpload1" OnClientUploadComplete="uploadComplete" OnClientUploadError="uploadError" 
  CompleteBackColor="White" Width="350px" runat="server" UploaderStyle="Modern" UploadingBackColor="#CCFFFF" 
  ThrobberID="imgLoad" OnUploadedComplete="fileUploadComplete" /&gt;&lt;br /&gt;
  &lt;asp:Image ID="imgLoad" runat="server" ImageUrl="loading.gif" /&gt;
  &lt;br /&gt;
  &lt;asp:Label ID="lblMsg" runat="server" Text=""&gt;&lt;/asp:Label&gt;
  &lt;/div&gt;
      &lt;asp:HiddenField ID="RandomFolder" runat="server"/&gt;
      &lt;asp:HiddenField ID="FilePath" runat="server"/&gt;
       &lt;asp:HiddenField ID="myFilePath" runat="server"/&gt;
       &lt;asp:HiddenField ID="lblFilename" runat="server"/&gt;
       &lt;button id="btndetails" class="btn btn-danger btnconvert" type="button"&gt;Convert file&lt;/button&gt;
      &lt;/div&gt;
  </code></pre>