title: Create link button in code behind, to make it call another method in code behind
body: <p>I have been looking for a way to create a link in my code behind which will call a method in my code behind with its ID as parameter. It is basicly a getting content from the database and show it, then being able to delete a row if needed. This is my code:</p>
  
  <pre><code>    protected void showDBContent(object sender, EventArgs e)
  {
      String queryString = "";
      if (showDBDropDown.Text == "Show all")
      {
          queryString = "SELECT * from dbo.Search";
      }
      else
      {
          queryString = "SELECT * from dbo.Search where Tag = '" + (showDBDropDown.Text).TrimStart().TrimEnd() + "'";
      }
      List&lt;String&gt; tags = new List&lt;String&gt;();
      List&lt;String&gt; urls = new List&lt;String&gt;();
      using (SqlConnection conn = new SqlConnection(info.connectionString))
      using (var cmd = conn.CreateCommand())
      {
          conn.Open();
          cmd.CommandText = queryString;
          using (SqlDataReader reader = cmd.ExecuteReader())
          {
              while (reader.Read())
              {
                  tags.Add(reader.GetString(0));
                  urls.Add(reader.GetString(1));
              }
          }
      }
      HtmlTable tempTable = showDBTable;
      int i = 0;
      foreach (String tag in tags)
      {
          String url = urls[i];
          HtmlTableRow row = new HtmlTableRow();
          HtmlTableCell cell1 = new HtmlTableCell();
          HtmlTableCell cell2 = new HtmlTableCell();
          HtmlTableCell cell3 = new HtmlTableCell();
          LinkButton link = new LinkButton();
          link.Click += new EventHandler(DeleteRow);
          link.Text = "Delete";
          link.ID = "deleteRow" + i;
  
          cell3.Controls.Add(link);
          row.Cells.Add(cell3);
          cell1.InnerText = tag;
          row.Cells.Add(cell1);
          cell2.InnerText = url;
          row.Cells.Add(cell2);
          tempTable.Rows.Add(row);
          i++;
      }
  }
  protected void DeleteRow(object sender, EventArgs e)
  {
  
  }
  </code></pre>
  
  <p>However it if never getting in the method DeleteRow.
  Any clues?</p>