Click here to Skip to main content
15,915,702 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi frds please help for me..
I am not getting any error but value is not updated in gridview i check with debug its shows only old value not show update value...
VB
protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
         
     
        GridViewRow row = (GridViewRow)GridView2.Rows[e.RowIndex];
        int BookingRefNo=int.Parse(GridView2.DataKeys[e.RowIndex].Value.ToString());
             
        string AssignedPriority = ((TextBox)row.Cells[11].Controls[0]).Text;
        string Status = ((TextBox)row.Cells[12].Controls[0]).Text;

        
        
        SqlConnection con1 = new SqlConnection(constr);
        SqlCommand cmd = new SqlCommand("Update TSafetyMaster set AssignedPriority=@AssignedPriority,Status=@Status where BookingRefNo=@BookingRefNo", con1);
        cmd.Parameters.Add("@BookingRefNo", SqlDbType.Int).Value = BookingRefNo;
        cmd.Parameters.Add("@AssignedPriority", SqlDbType.VarChar).Value = AssignedPriority;
        cmd.Parameters.Add("@Status", SqlDbType.NVarChar).Value = Status;
        con1.Open();
        cmd.ExecuteNonQuery();
        GridView2.EditIndex=-1;
        GridView2.DataBind();
        

        
    }
Posted
Updated 14-May-14 21:51pm
v2

1 solution

if I am not wrong have you used if(!Ispostback) in your pageload event
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900