you have to add some controls to the code behind and in the correct event and register it instead of the exception (postback) and AsyncPostBack, which is an ajax call.
ScriptManager.GetCurrent (this) .RegisterPostBackControl (btnAdd);
fooobar.com/questions/1331372 / ...
protected void grdExpense_RowCreated(object sender, GridViewRowEventArgs e) { LinkButton btnAdd = (LinkButton)e.Row.Cells[0].FindControl("btnAdd"); if (btnAdd != null) { ScriptManager.GetCurrent(this).RegisterPostBackControl(btnAdd); } }
find another similar page that excludes all controls in gridview
http://www.aspsnippets.com/Articles/Assign-PostBack-Trigger-Full-PostBack-for-LinkButton-inside-GridView-within-AJAX-UpdatePanel-in-ASPNet.aspx
private void RegisterPostBackControl() { foreach (GridViewRow row in GridView1.Rows) { LinkButton lnkFull = row.FindControl("lnkFull") as LinkButton; ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkFull); } }
source share