title: Setting an ASP LinkButton control's text via JQuery and JSON
body: <p>I have an ASP.net 4.0 site to modify.  In particular, I want to set the text value of a LinkButton control to a filename:</p>
  
  <pre><code>&lt;asp:LinkButton ID="LinkButtonFile1" runat="server" OnClick="GetFile"&gt;
  </code></pre>
  
  <p>I want to do this on the client side with JQuery and a JSON object:</p>
  
  <pre><code> var FileNames = { "name": "testing" };
   var id = ('id=$LinkButtonFile1').val();
   ('id=$LinkButtonFile1').val() = FileNames.name
  </code></pre>
  
  <p>I use 'id=..' because I'm using a Master Page and i found from googling that issue is solved by doing this. Running this is debug on VS2010 reveals that 'val()' is not a valid property.  I've tried many variations including:</p>
  
  <pre><code> var FileNames = { "name": "testing" };
  //var id = document.getElementById("&lt;%= $LinkButtonFile1 %&gt;");
  //var id = document.getElementById('[id$=LinkButtonFile1]');
  var id = document.getElementById('id$=LinkButtonFile1');
  
  var id = document.getElementById('$LinkButtonFile1');
  //('[id=$LinkButtonFile1]').val(FileNames.name);
  </code></pre>
  
  <p>which returns id = null.</p>
  
  <p>I've googled many sites trying to get the right syntax but nothing is working for me.  Can anyone tell me the right syntax?</p>
  
  <p>thanks</p>