--code behind--
 protected void findcourse()
    {
        foreach (GridViewRow grow in GridView2.Rows)
        {
            DropDownList drop1 = (DropDownList)grow.FindControl("DropDownList1");
            con.Open();
            SqlCommand cmd = new SqlCommand("select descr from restrnt_master", con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet dt = new DataSet();
            da.Fill(dt);
            con.Close();
            drop1.DataSource = dt;
            drop1.DataTextField = "descr";
            drop1.DataBind();
            drop1.Items.Insert(0, new ListItem("--Select--", "0"));
        }
    }
--source code--
  <asp:TemplateField HeaderText="Item">
                                    <ItemTemplate>
                                        <asp:Label ID="Label8" runat="server" Text='<%# Eval("item") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
                                            SelectedValue='<%# Eval("item") %>'
                                            onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                                        </asp:DropDownList>
                                    </EditItemTemplate>
                                    <FooterTemplate>
                                        <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" 
                                            onselectedindexchanged="DropDownList2_SelectedIndexChanged">
                                        </asp:DropDownList>
                                        <br />
                                    </FooterTemplate>
                                </asp:TemplateField>
This shows the following error when page is loaded.kindly help to identify the error. I have added the findcourse() function in the page load and after insert,update codings
System.NullReferenceException: Object reference not set to an instance of an object.
 
    