Refreshing gridview after update
<p>I am having trouble trying to get my gridview to refresh after I update it. The DB takes the updates and I can see them there when I manually refresh the page, but not when I click the update link to commit the changes. </p>

<p>I tried to call the funtion that fills the grid, I recieve a js error "Microsoft JScript runtime error: Unable to get value of the property 'firstChild': object is null or undefined".
It runs through the method and doesn't throw that error until after it has exited.</p>

<p>Is there another approach that I can take to refresh my grid after Update?</p>

<p>Here is the code:</p>

<pre><code>    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindCustodiansByProjectID();
            BindCustodianMedia(EditMediaClass.outRequestMediaID);
        }
    }

        private void BindCustodianMedia(string MediaID)
    {
        DataTable dt = new DataTable();
        SqlConnection conn = new SqlConnection(GetConnString());
        DataSet ds = new DataSet();
        try
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("usps_displayEditMedia_CustodianMedia", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@aspMediaID", SqlDbType.Int)).Value = int.Parse(MediaID);
            cmd.ExecuteNonQuery();

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(ds);

            grd_custodianMedia.DataSource = ds;
            grd_custodianMedia.DataBind();
        }

        protected void updateCustodianMedia_OnUpdateCommand(object sender, GridRecordEventArgs e)
    {
        SqlConnection conn = new SqlConnection(GetConnString());
        conn.Open();
        try
        {
            SqlCommand cmd = new SqlCommand("usps_updateCustodianMedia_EditMedia", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add(new SqlParameter("@aspCustodianMediaID", SqlDbType.Int)).Value = int.Parse(e.Record["CustodianMediaID"].ToString());
            cmd.Parameters.Add(new SqlParameter("@aspMediaID", SqlDbType.Int)).Value = int.Parse(EditMediaClass.outRequestMediaID.ToString());
            cmd.Parameters.Add(new SqlParameter("@aspCustodianID", SqlDbType.Int)).Value = int.Parse(e.Record["CustodianID"].ToString());
            cmd.Parameters.Add(new SqlParameter("@aspUploadPath", SqlDbType.VarChar)).Value = e.Record["UploadPath"];
            cmd.Parameters.Add(new SqlParameter("@aspDataSize", SqlDbType.VarChar)).Value = e.Record["DataSize"];
            cmd.Parameters.Add(new SqlParameter("@aspDataDesc", SqlDbType.VarChar)).Value = e.Record["DataDescription"];

            cmd.ExecuteNonQuery();
            //BindCustodianMedia(EditMediaClass.outRequestMediaID);    

        }
</code></pre>
