Referencing webcontrols in an UpdatePanel in EditItemTemplate of a Gridview

298 Views Asked by At

I am getting null reference exception when trying to reference a web control which is within an AJAX UpdatePanel, which itself is within and EditItemTemplate of a Gridview. I am doing this in the RowDataBound event handler of the gridview as follows:

protected void gvIntakes_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            DataRowView row = (DataRowView)e.Row.DataItem;
            UpdatePanel up = (UpdatePanel)e.Row.FindControl("Status_UpdatePanel"); //**** up is showing null on debug
            Panel pnlSelectStaff = (Panel) up.FindControl("pnlSelectStaff")  ;
            Panel pnlSchedule = (Panel)up.FindControl("pnlSchedule");
0

There are 0 best solutions below