It is master page code
<asp:GridView ID="grdview" runat="server" CssClass="table table-bordered" AutoGenerateColumns="False" DataKeyNames="OwnId" OnRowEditing="grdview_RowEditing" OnPageIndexChanging="grdview_PageIndexChanging" OnRowCancelingEdit="grdview_RowCancelingEdit" OnRowUpdating="grdview_RowUpdating">
</asp:GridView>
It is child page code
In child page give this error
"Object reference not set to an instance of an object."
public void Ownerbind()
{
GridView grdview = (GridView)Master.FindControl("grdview");
SqlConnection con = new SqlConnection(cn.ConnectionStrings);
String Bind = "SELECT [OwnId],[OwnerCode],[FirstName],[LastName],[MobileNo],[Email] FROM [WebCrm].[dbo].[tbl_Owner]";
con.Open();
adp = new SqlDataAdapter(Bind, con);
ds = new DataSet();
adp.Fill(ds);
con.Close();
if (ds.Tables[0].Rows.Count > 0)
{
grdview.DataSource = ds;
grdview.DataBind();
}
else
{
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
grdview.DataSource = ds;
grdview.DataBind();
int columncount = grdview.Rows[0].Cells.Count;
grdview.Rows[0].Cells.Clear();
grdview.Rows[0].Cells.Add(new TableCell());
grdview.Rows[0].Cells[0].ColumnSpan = columncount;
grdview.Rows[0].Cells[0].Text = "No Records Found";
}
}