title: how to create dynamicly generated button that call server side method in using javascript in ASP.Net c#
body: <p><strong>My problem</strong><br/>
  1) I created aspx page and put literal on it.<br/>
  2) In .cs file->fetch data from db and bind it on literal<br/>
  e.g
  literal is that control
  then</p>
  
  <pre><code> literal+="&lt;tr&gt;&lt;td&gt;data goes here&lt;/td&gt;&lt;td&gt;here i want put my button&lt;/td&gt;&lt;/tr&gt;"
  </code></pre>
  
  <p>then how to raise click event from html control .</p>
  
  <pre><code>**.aspx page**
  
  &lt;div class="table-primary"&gt;
              &lt;table&gt;
                 &lt;thead&gt;
                     &lt;tr&gt;
                         &lt;th&gt;#&lt;/th&gt;
                         &lt;td&gt;Sales Person&lt;/td&gt;
                         &lt;td&gt;Employee Code&lt;/td&gt;
                         &lt;td&gt;Status&lt;/td&gt;
                         &lt;td&gt;Action&lt;/td&gt;
                     &lt;/tr&gt;
                 &lt;/thead&gt;
                  &lt;tbody&gt;
                      &lt;asp:Literal ID="Literal1" runat="server"&gt;&lt;/asp:Literal&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <p>.cs page</p>
  
  <pre><code>protected void BindData()
  {
      int i = 0;
      DataTable dt = VijayDB.ExecuteSqlQueryForDataTable(CommandType.StoredProcedure, "SFA_GetAllSalesPerson", null);
      foreach (DataRow dr in dt.Rows)
      {
          Literal1.Text += "&lt;tr&gt;";
          Literal1.Text += "&lt;td&gt;"+(i++)+"&lt;/td&gt;";
          Literal1.Text += "&lt;td&gt;" + dr["person_name"] + "&lt;/td&gt;";
          Literal1.Text += "&lt;td&gt;" + dr["fk_hrme_employee_id"] + "&lt;/td&gt;";
          Literal1.Text += "&lt;td&gt;" + dr["person_status"] + "&lt;/td&gt;";
          Literal1.Text += "&lt;td&gt;&lt;a href='javascript:Edit(" + dr["pk_sfa_stm_salesperson_id"] + ");'&gt;Edit&lt;/td&gt;";
          Literal1.Text += "&lt;/tr&gt;";
      }
  }
  </code></pre>