I have a gridview with "select" row and paging. I´m getting an error when I try to change paging site.
I can get rid of this issue if i use If()
statement but then my select event wont work.
/*************Acitivate "Search" column for every row in gridview******************/
protected void gwActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
/*if (e.CommandName.ToString() == "Select")*/
{
GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
txtActivity.Text = row.Cells[2].Text;
ddlStatus.SelectedValue = row.Cells[4].Text;
ddlResponsible.SelectedValue = row.Cells[5].Text;
ddlCategory.SelectedValue = row.Cells[6].Text;
ddlPriority.SelectedValue = row.Cells[7].Text;
ddlSize.SelectedValue = row.Cells[8].Text;
ddlSystem.SelectedValue = row.Cells[9].Text;
ddlChange_Requestor.SelectedValue = row.Cells[10].Text;
txtComment.Text = row.Cells[11].Text;
}
}
ERROR:
An exception of type 'System.InvalidCastException' occurred in App_Web_rsb5hpia.dll but was not handled in user code Additional information: Unable to cast object of type 'System.Web.UI.WebControls.GridView' to type 'System.Web.UI.WebControls.LinkButton'.