Editing function for an XML Gridview in ASP.NET-Collection of common programming errors

I want to write, update or edit a function for an XML gridview in ASP.net (in visual studio 2010), but I don’t know which action I should use?

This is my code but it doesn’t work. When I click edit on the gridview an exception occured:

 private DataSet ds;
    DataRow r;
    protected void Page_Load(object sender, EventArgs e)
    {
        ds = new DataSet();
        ds.ReadXml(Server.MapPath("../web.config"));
        GridView1.DataSource = ds.Tables["user"];
        GridView1.DataBind();

    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridView1.EditIndex = e.RowIndex;
        GridView1.DataBind();
    }

    protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
    {

        r = ds.Tables["user"].Rows[e.AffectedRows];
        r["password"] = FormsAuthentication.HashPasswordForStoringInConfigFile(GridView1.SelectedRow.Cells[1].ToString(), "MD5");


        ds.AcceptChanges();
        ds.WriteXml(Server.MapPath("web.config"));
        GridView1.DataBind();
    }

thanks