title: To get value set in javascript in code behind
body: <p>I have following in html</p>
  
  <pre><code>&lt;div id="dvAddToGrid" runat="server"&gt;
   &lt;table style="margin-left:80%"&gt;
    &lt;tr&gt;
     &lt;td&gt;
       &lt;asp:LinkButton ID="lnkAddToGrid" runat="server" Text="Add New" onclick="lnkAddToGrid_Click" OnClientClick="GetValues()" Font-Underline="True"&gt;&lt;/asp:LinkButton&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
   &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have following in javascript</p>
  
  <pre><code>function GetValues() {
  
  //    for (i = 1; i &lt;= 5; i++) 
  //    {
  //        $("#hdnTableValues")[0].value += document.getElementById("txtSerialNo_1").value+ ",";
  //        $("#hdnTableValues")[0].value += document.getElementById("txtBookName_1").value + ",";
  //        $("#hdnTableValues")[0].value += document.getElementById("txtAuthor_1").value + ",";
  //        $("#hdnTableValues")[0].value += document.getElementById("txtPublisher_1").value + ",";
  //        $("#hdnTableValues")[0].value += document.getElementById("txtNoOfBooks_1").value + ",";
  //        $("#hdnTableValues")[0].value += document.getElementById("txtRemarks_1").value + "|";
  //           //    }
      document.getElementById("lblTableValues").innerHTML = $("#hdnTableValues")[0].value ;
  
  }
  </code></pre>
  
  <p>In my code behind i have </p>
  
  <pre><code> protected void lnkAddToGrid_Click(object sender, EventArgs e)
          {
              DataTable dtBookList = new DataTable();
              dtBookList.Columns.Add("SerialNo");
              dtBookList.Columns.Add("BookName");
              dtBookList.Columns.Add("Author");
              dtBookList.Columns.Add("Publisher");
              dtBookList.Columns.Add("NoOfBooks");
              dtBookList.Columns.Add("Remarks");
              string str = lblTableValues.Text ;
              for(int i=1;i&lt;5;i++)
              {
                  DataRow dtRow = dtBookList.NewRow();
                  //hdnTableValues.Value 
              }
                         dvBookList.Visible = false;
              dvAddToGrid.Visible = false;
  
          }
  </code></pre>
  
  <p>Problem is i am getting values in lblTableValues in js.But in code behid it does not contain any values its value is "".Can anybody help to get the value contained in hdnTableValues in click event in code behind.</p>