Unable to cast object of type 'System.Web.UI.WebControls.Button' to type 'System.Web.UI.WebControls.GridView'.
this button is in page
protected void BtnSave_OnClick(object sender, EventArgs e)
{
btnRewrk_OnClick(sender,e);
}
here i want to call the bellow event method in which button is in gridview, so here i am getting error:
Unable to cast object of type 'System.Web.UI.WebControls.Button' to type 'System.Web.UI.WebControls.GridView'.
This button is in gridview
protected void btnRewrk_OnClick(object sender, EventArgs e)
{
GridViewRow row = (GridViewRow)(((Control)sender).NamingContainer);
}