Linkbutton click event does not work inside gridview
<p>I have a webpage where I have a gridview. I have populated the gridview on page load event.</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{          
   if (!IsPostBack)
   {
      loadGridView();
   }
}
</code></pre>

<p>This is the load gridview method.</p>

<pre><code>private void loadGridView()
{
   dataTable dt = getData(); // this function populates the data table fine.
   gridView1.dataSource = dt;
   gridview1.dataBind();
}
</code></pre>

<p>Now I have added linkButtons in one of the gridview columns in the RowDataBound event of the grid view.</p>

<pre><code>protected void gvTicketStatus_RowDataBound(object sender, GridViewRowEventArgs e)
{
   LinkButton lb = new LinkButton();
   lb.Text = str1; // some text I am setting here
   lb.ID = str2;   // some text I am setting here
   lb.Click += new EventHandler(lbStatus_click);
   e.Row.Cells[3].Controls.Add(lb);
}
</code></pre>

<p>Finally This is the event Handler code for the link button click event.</p>

<pre><code>private void lbStatus_click(object sender, EventArgs e)
{
    string str = ((Control)sender).ID;
    // next do something with this string
}
</code></pre>

<p>The problem is, the LinkButtons appear in the data grid fine, but the click event does not get execute. the control never reaches the event handler code. when I click the link button, the page simply gets refreshed. What could be the problem?</p>

<p>I have tried calling the loadGridView() method from outside the (!isPostBack) scope, but it did not help!</p>
