Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I thought it should be a simple question so I can get the result from codebehind....but now I understand..how difficult question this is...

after deleting a row from gridview/dataset....gridview is not refreshing...

I tried

C#
UpdatePanel1.Update();
Cache.Insert("RewardDS", MyDs);
MyDs = null;
MyDs = (DataSet)Cache["RewardDS"];
GridView1.DataSource = null;
GridView1.DataSource = MyDs;
GridView1.DataBind();

delete is happening but gridview is not refreshing
plz someone help
Posted
Updated 26-Aug-13 1:23am
v6
Comments
VICK 26-Aug-13 4:44am    
MyDs = (DataSet)Cache["RewardDS"];

What is the output of the above line.. use the break point to check either its extracting the data set properly from cache or not...
Miss Maheshwari 26-Aug-13 5:47am    
in MyDs dataset from cache is fetched...I used it in complete project
VICK 26-Aug-13 5:59am    
You are getting dataset from DB,
deleting a row from there and than binding your gridview with the DS....

RYt???

In this case gridview is getting bind with the old gridview..

You have to get the dataset ,
delete the row, update the db,
Reget the dataset with updated data,
and than bind with gridview....

HOpe that gonna work.

OR do the deletion before putting dataset in cache or update the cache with updated dataset....
Miss Maheshwari 26-Aug-13 6:41am    
I am binding gridview with dataset...
deleting a row from dataset den updating the dataset and again rebind my gridview that updated dataset
Dholakiya Ankit 26-Aug-13 7:42am    
u are using single dataset in entire project that is not good idea
in above scenario you are fetching data from cache so check by debugging that in cache data is refreshing or not
regards..:)

1 solution

I believe you should not call "AcceptChanges" on dataset in your delete function. Please follow below link for more information.

differences between update and acceptchanges[^]
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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