How to update the page without reload using update panel ?AP.NET C#
<p>I have a gridview which contains an edit and a delete command.</p>

<p>I would like that when I click on edit, update the value, and click on delete that the value is deleted from database and the page is not reloaded.</p>

<p>Now, I use update panel and script manager but the page is reloaded again, the Update panel is not working. And my other problem is when I put <code>&lt;form runat="server"&gt;&lt;/form&gt;</code> form tag before gridview then it's working fine, the gridview shows, but when I remove this tag then an error appears:</p>

<blockquote>
  <p>object reference not set instance object.</p>
</blockquote>

<p>My aspx code is :</p>

<pre><code>&lt;asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server"&gt;
&lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;&lt;/asp:ScriptManager&gt;
&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt;
&lt;form runat="server"&gt;&lt;/form&gt;
    &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="Database_id" Height="184px" 
    onrowcancelingedit="GridView1_RowCancelingEdit" 
    onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" 
    onrowupdating="GridView1_RowUpdating" style="margin-left: 181px" Width="361px" 
        BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
        CellPadding="3" onselectedindexchanged="GridView1_SelectedIndexChanged"&gt;
    &lt;Columns&gt;
        &lt;asp:TemplateField HeaderText="Database Name"&gt;
            &lt;EditItemTemplate&gt;
                &lt;asp:TextBox ID="txtDatabaseName" runat="server" Height="22px" 
                    Text='&lt;%# Eval("Database_Name") %&gt;' Width="192px"&gt;&lt;/asp:TextBox&gt;
            &lt;/EditItemTemplate&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("Database_Name") %&gt;'&gt;&lt;/asp:Label&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;asp:TemplateField HeaderText="Description"&gt;
            &lt;EditItemTemplate&gt;
                &lt;asp:TextBox ID="txtdescription" runat="server" Height="24px" 
                    Text='&lt;%# Eval("Description") %&gt;' Width="209px"&gt;&lt;/asp:TextBox&gt;
            &lt;/EditItemTemplate&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Eval("Description") %&gt;'&gt;&lt;/asp:Label&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;asp:TemplateField HeaderText="Date"&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:Label ID="Label3" runat="server" Text='&lt;%# Eval("Date") %&gt;'&gt;&lt;/asp:Label&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;asp:CommandField HeaderText="Operations" ShowDeleteButton="True" 
            ShowEditButton="True" /&gt;
    &lt;/Columns&gt;
        &lt;FooterStyle BackColor="White" ForeColor="#000066" /&gt;
        &lt;HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /&gt;
        &lt;PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /&gt;
        &lt;RowStyle ForeColor="#000066" /&gt;
        &lt;SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /&gt;
        &lt;SortedAscendingCellStyle BackColor="#F1F1F1" /&gt;
        &lt;SortedAscendingHeaderStyle BackColor="#007DBB" /&gt;
        &lt;SortedDescendingCellStyle BackColor="#CAC9C9" /&gt;
        &lt;SortedDescendingHeaderStyle BackColor="#00547E" /&gt;
&lt;/asp:GridView&gt;
&lt;/ContentTemplate&gt;&lt;/asp:UpdatePanel&gt;
&lt;/asp:Content&gt;
</code></pre>

<p>and my aspx.cs code is :</p>

<pre><code>    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            binddata();
        }
    }
    private void binddata()
    {
    string con = "Data Source=HAMEED_KHAN\\SQLEXPRESS;Initial Catalog=db_compiler;Integrated Security=True";

     DataTable dt = new DataTable();
     using (SqlConnection cnn = new SqlConnection(con))
     {
            string user = Session["name"].ToString();
            SqlCommand cmd2 = new SqlCommand("SELECT User_ID from tbl_user WHERE User_Name='" + user + "'", cnn);
            cnn.Open();
            string id = cmd2.ExecuteScalar().ToString();
            int ID = Int32.Parse(id);
            SqlDataAdapter da = new SqlDataAdapter("SELECT Database_id,Database_Name,Description,Date FROM Create_db WHERE User_ID='" + ID + "'", cnn);
            da.Fill(dt);
            if (dt.Rows.Count &gt; 0)
     {
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
    }
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1.EditIndex = -1;
        binddata();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
        delete(id);
        GridView1.EditIndex = -1;
   }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
        TextBox txtDatabaseName = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDatabaseName");
        TextBox txtdescription = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtdescription");
        updatedb(txtDatabaseName.Text, txtdescription.Text, id);
        GridView1.EditIndex = -1;
        binddata();
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
      GridView1.EditIndex = e.NewEditIndex;
     binddata();
     }
    private void updatedb(string dbname, string Dis, int id)
    {
    string con = "Data Source=HAMEED_KHAN\\SQLEXPRESS;Initial Catalog=db_compiler;Integrated Security=True";
     using (SqlConnection cnn = new SqlConnection(con))
     {
     string query = "UPDATE Create_db SET Database_Name='" + dbname + "',Description='" + Dis + "' WHERE Database_id='" + id + "' ";
     SqlCommand cmd = new SqlCommand(query, cnn);
     cnn.Open();
     cmd.ExecuteNonQuery();
     }
     }
    private void delete(int id)
    {
        string con = "Data Source=HAMEED_KHAN\\SQLEXPRESS;Initial Catalog=db_compiler;Integrated Security=True";
        using (SqlConnection cnn = new SqlConnection(con))
        {
        string query = "DELETE FROM Create_db WHERE Database_id='" + id + "' ";     
      SqlCommand cmd = new SqlCommand(query, cnn);
       cnn.Open();
       cmd.ExecuteNonQuery();
     }
     }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    public override void VerifyRenderingInServerForm(Control control)
    {
        //base.VerifyRenderingInServerForm(control);
    }
</code></pre>