Link to home
Start Free TrialLog in
Avatar of sarang8180
sarang8180

asked on

Gridview UpdateProblem

How to Update the values in gridview if it shows old values....

 FillData();
           
            GridViewRow gr1 = (GridViewRow)dgrData.Rows[e.RowIndex];
             
            TextBox tCategory=(TextBox)gr1.FindControl("txtCategory");
         
            //DataBind();
            string update = "update category set category='" + tCategory.Text + "' where cat_id=" + dgrData.DataKeys[e.RowIndex].Values[0].ToString() + "";
Avatar of deepu chandran
deepu chandran
Flag of Germany image

Hi,

Call the Load Grid function again,that means

1) Get the data from the DB
2) the List/Dataset/Datatable assign to Grid.Datasource
3) call Grid.Databind() again

-- Deepu
Avatar of Pratima
here you will get some good examples

http://forums.asp.net/t/1255252.aspx/1
Avatar of sarang8180
sarang8180

ASKER

if i call the data from database again and bind to gridview,it shows old data in textbox of gridview.

If i don't call,keep it in !IsPostBack.Then Gridview vanishes on click of update link
ASKER CERTIFIED SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial