title: how to pass value from asp.net server control using jQuery?
body: <p>I UPDATED the code with code behind. I'm doing something dynamic with the label contrtol.</p>
  
  <p>I have the following jQuery code working as it is (passing the value of 'test") but what I want to do is to pass the value of the label control (lblNames). I'm using the label control to collect the uploaded file names. Is there a way?</p>
  
  <p>jQuery:</p>
  
  <pre><code>$(document).ready(function () {
      $("#btnUpload").click(function () {
          $("#Notes", top.document).val('test');
      });
  });
  </code></pre>
  
  <p>ASPX code:</p>
  
  <pre><code>&lt;asp:Label ID="lblNames" runat="server" visible="true" &gt;&lt;/asp:Label&gt;
  </code></pre>
  
  <p>Code Behind:</p>
  
  <pre><code>    Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs)    Handles btnUpload.Click
      Dim fileExt As String
      fileExt = System.IO.Path.GetExtension(FileUpload1.FileName)
  
      If (fileExt &lt;&gt; ".exe") Then
          Dim fileNames As New List(Of String)
  
          Try
              Dim hfc As HttpFileCollection = Request.Files
              lblFiles.Text = String.Empty
              lblNames.Text = String.Empty
  
              For i As Integer = 0 To hfc.Count - 1
                  Dim hpf As HttpPostedFile = hfc(i)
                  If hpf.ContentLength &gt; 0 Then
                      fileNames.Add(hpf.FileName)
                      hpf.SaveAs(Server.MapPath("/directory") &amp; "\" &amp; System.IO.Path.GetFileName(hpf.FileName))
                      lblFiles.Text += "&lt;b&gt;File: &lt;/b&gt;" &amp; hpf.FileName &amp; "     " &amp; "    Uploaded Successfully! &lt;br /&gt;"
                      lblNames.Text += hpf.FileName &amp; ", "
                  Else
                      lblWarning.Text = "Please choose a file to upload."
                  End If
              Next i
          Catch ex As Exception
  
          End Try
  </code></pre>