When I delete something in my GridView, my data is delete in the database but not on my GridView

I've got a GridView, when I click on the delete button, my data is deleted in the database but not on my GridView. When I press on F5 for refresh my browser, my datarow is deleted. So is it possible the clear the cache of the GridView ? Or is there an other solution for this problem ?

Kind Regards,

Joeri Pansaerts.

From Bruges, Belgium :)
9/10/2008 4:08:28 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 8

rebind your gridview... 


Please remember to click “Mark as Answer” on the post that helps you.. =)
9/10/2008 5:13:50 AM


rebind your gridview... 

rebinding is the process u have to do if u re manually binding to the gridview. in case it is thru sqldatadource then i guess rebinding process happens automatically


Jai Ganesh. J , GSD ,India

Please Mark As Answer If my reply helped you.
9/10/2008 5:18:04 AM

Call the bind function after your delete record function


If(MyPost Helps You)
“Mark as Answer”
9/10/2008 5:28:07 AM

Agree with other posters...

 If you are using Try.. Catch.. Finally blocks, place   gv1.DataSource = (your dataset);



or else, place the same code after delete operation.

Achutha Krishnan

~ No one can do everything, but everyone can do something ~
9/10/2008 1:27:29 PM


Rebind your grid. after deleting the record from grid

9/10/2008 1:32:27 PM

Similar Artilces:

Adding data to gridview from two textboxes and then deleting them by delete button in each gridview row.
Hi, my app has 2 textboxes if i enter data and click add button they shud be added to gridview with 2 columns ex: custid from txtbox1 ... and custname frm txtbox2 added to gridview   with columns custid and custname then    foreach row a delete button shud appear in gridview and on clicking it shud delete the row can any one send me code for dis   thanks in advance Hi, In your Button Click Event write this code. DataControlField dCusId; DataControlField dCustName; dCusId.HeaderText = textbox1.text; dCustName.HeaderText = textbox2.text Gridv...

Gridview Delete not Deleting
I am trying to use a command button to delete a row from a gridview. When I click the command button though, the page posts but my record is still there... no errors, just nothing seems to happen. Below is what I think is the relevant code, let me know if you need to see anything else.  I'm kinda new to working with gridview objects, it would be nice if I could see what SQL command is acctually ran... maybe there are other things I can check too, I'm just not sure how.   <asp:GridView ID="GridView1" runat="server" AllowSorting="True"&nbs...

Gridview Delete Button that Deletes data and file at the same time.
Hi :i have a gridview for my news administration. I insert news title, news details, news picture's path ( like news_image457.gif ) to my MSSQL database. I store news pictures in a Folder. ( like /mysite/newsimages )When i delete a record from the gridview, i can only delete the record from my database.But i can not delete the pictures from the Folder that i have uploaded before. How can i do that? ( please by using VB ) I mean i have to delete the news records from database and picture of the news from folder at the same time. Really sorry for my poor Engl...

How to delete controls in GridView when the delete button in a row is clicked
Hi,   I am having issues with my gridview.....i added 2 dropdown and 2 compare validators....whenever i delete a row though......the dropdown and compare validators are becoming null........thus when i click a button, it is still validating.............anyway to delete this when i click the delete button or even handle?   Please help.  ...

Delete (Hide) Row from Gridview without deleting from DataBase
I am populating some data in a GridView.I added a column with a checkbox.Now I want to generate a sort of print-preview...When Ich check some buttons and hit my printpriview button. I only want these (selected rows displayed).How can I do this?The checkbox thing is already working What I basically need is something to delete data temporaly from a GridView (not Database).I tryed GridViewRow.Dispose() which worked but then the paging was still implementet and the user sees still all pages =(I have tryed GridViewRow.Enabled = false which only turned the colors =(I have used GridViewRow.Visible ...

how can i delete data from gridview but not on the database?
how can i delete data from gridiewbut not on the database? wherein i have a datagrid for approved applications.... and when the data's show that the applications are already approved i have the option to delete it form mygridview.but not on the database.... I just dont want it to be shown in the gridview.... but the records are still in the database...not deleted...  Im using ASP.NET microsoft webdeveloper and visual basic.net!   help please thanx, nat:-)   You are not deleting record. You can use a flag column( such as a bit column) for the gr...

DataList with Nested Editable/Deletable Gridviews. Gridviews not updating parent on edit/delete.
<DataList "Groups">  <Item>      <DataBound Title in DataList>       <Gridview of Items in "Current Group from DataList">       <SqlDataSource for GridView> </Item></DataList><SqlDataSource for DataList> Everything displays fine, I can edit individual rows in the nested grids and I can insert Rows in the grids.But the edit/delete events will not trigger the DataList to rebind its contents.. so onEdit/onDelete in the gridviews I say "DataList.Dat...

Delete in GridView using OnClick method not Refreshing GridView Control
Hi, I have added a GridView control to my Personal Site and am using it to edit the content of the site, which I am storing in an MS Access database. The content is stored in a table called SiteContent with 4 columns: ContentCode, ContentLineNo, ContentElementType and ContentText. Without any code, the Delete LinkButton of the GridView was happily deleting rows from the table and refreshing immediately to show the change. However, I wanted the Delete LinkButton to also reduce the ContentLineNo column of each following row by 1, so I removed its CommandName="Delete" attribute and substitute...

delete row or delete all in Gridview?
Hi there, I have a Gridview that bind the data from the .mdb  and I want to have 2 delete buttions, one is delete a row and the other one is delete all from the database.  How do I do it in code behind in c#?  thanks a lot row delete  (temp call rowDel) all delete (temp call allDel) with rowDel: i think you should bound one column in gridview  (or datagrid)<asp:ButtonColumn... and bout allDel: i think you should use a button distinct with gridview.Becoz your required is not complex , when allDel be push you don't care...

GridView-Mysql-bind Gridview control to SqlDataSource -problem-Delete Command
 DeleteCommand="DELETE FROM relatorios WHERE codigo=codigo"> this works but delete everythingi have tryed thisWHERE codigo='codigo' ">and WHERE codigo=?codigo"> sintax error on mysql the full code is below :  <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" CellPadding="4" DataKeyNames="codigo"  AutoGenerateDeleteButton="True"  DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="Non...

Problem: Delete image from SQL server database in gridview control c#
 I build a website containing a database with image. Insert operation works pretty good. However, when I click delete operation, it appears the error page shown below.The way I save image to my database is to convert it as binary image by using handler.Can someone help me solving this problem.....thanks very much!!      <a href="http://s243.photobucket.com/albums/ff172/photossed/?action=view&current=1.jpg" target="_blank"><img src="http://i243.photobucket.com/albums/ff172/photossed/1.jpg" border="0" alt=&...

Deleting a data from gridview
i was able to delete A record from the gridview, but i am stuck when i want to update the gridview with the new set of records.  I mean i dont want to see the file in the gridview which i deleted. Can anyone plese help me with this.  Thanks a lotSandy When you delete, you need to rebind your gridview to it's (now updated) datasource.protected void gview_RowDeleted(object sender, EventArgs e){    GridView1.DataSource = someDatasourceYouHave;    GridView1.DataBind();}If this post helped you, Mark As Answer. Thanks a lot!!!.. It helped mee..San...

how to delete data from gridview?
Hi all, I'm having trouble deleting data from a gridview, who can help out this newb?I have a gridview linked to a ObjectDataSource and selecting data is working just fine using a textbox + stored procedure to filter data.I created a stored procedure to delete data as well, based on the column_ID (primary key)I set the deleteMethod of the objectdatasource to the name of my delete stored procedure. Now, the only thing left is set ths deleteParameters right? I set that to the selectedIndex of my gridview, but I get the following error when trying to delete a row:ObjectDataSource 'Objec...

GridView with two datasouces / Copying data from one gridview into another gridview and then updating database
I have two GridView controls GridView1 and GridView2. GridView1 displays data from table1 through an access datasource. I then have a button on the page when clicked it copies the data from GridView1 into a DataTable and then I assign datatable as the datasource for GridView2, now what I want to do is GridView2 to connect to table2 in the access datasource and update the database table. Essentially what I am trying to do is read data from one datasouce and update another datasouce. The reason why I want to do this is I want to use GridView1 and table1 data as template and dont want to modify...

Web resources about - When I delete something in my GridView, my data is delete in the database but not on my GridView - asp.net.presentation-controls

Lawmaker Calls Planned Parenthood 'The Real Culprit' for Violence
Republican lawmaker in Colorado calls Planned Parenthood 'the real culprit' for violence

Sean Penn Blames Climate Change Denial on Cult-Like ‘Fox Network Thinking’
Sean Penn is in Paris this week for the big climate change summit, and in an interview he took a swipe at Fox News over widespread climate denial. ...

Spike Lee rips Rahm Emanuel on 'Chi-Raq' orange carpet
NEW YORK (AP) — Kind words are in short supply for Chicago Mayor Rahm Emanuel at the premiere of Spike Lee's "Chi-Raq" in New York.

Yahoo board to meet Wednesday for three days to plan future after Starboard increased pressure on company ...
Wall Street Journal : Yahoo board to meet Wednesday for three days to plan future after Starboard increased pressure on company to sell core ...

Carrie Fisher Felt Pressured to Lose Weight for 'Star Wars: The Force Awakens'
Carrie Fisher is opening up about how she felt pressured into losing weight to reprise her role as Princess Leia in the upcoming movie Star Wars: ...

Facebook's CEO and wife to give 99 percent of shares to their new foundation
Reuters Facebook's CEO and wife to give 99 percent of shares to their new foundation Reuters SAN FRANCISCO Mark Zuckerberg will put 99 percent ...

Google removes Chrome's notification center because nobody used it
As promised in October, Google has ditched Chrome's desktop notification center in its latest update, released today. The company first introduced ...

Hillary Clinton makes campaign stop on Quora
Democratic candidate for president visits the popular online forum to discuss health care, Planned Parenthood and being a grandmother.

U.S. deploying new force to Iraq to boost fight against Islamic State
By Phil Stewart and Yeganeh Torbati WASHINGTON (Reuters) - The United States said on Tuesday it was deploying a new force of special operations ...

iOS Support For Samsung Gear S2 Coming Soon
There are various smartwatches and fitness trackers available out there, but if you love the Samsung Gear S2 but were a bit bummed that there ...

Resources last updated: 12/2/2015 5:00:28 AM