refresh after delete

I have created a delete button with a conformation step. The delete button deletes a record from the db.

The delete works fine but the record doesn't dissapear until i refresh the page...


how can i acheive this?



Ilan Perez
web Developer | Designer
12/1/2008 3:11:05 AM 91979 articles. 3 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 2

This is probably due to the data bound control not being "re-bound" on postback.

The easiest way to achieve this is to call you delete method then at the end of the delete method call the rebind the control with the new dataset. Try that out, if it doens't work what are using for your data container? Sql Server, Access database, XML file etc?

Please mark post as answer - Progressive Web Methodologies

My Blog
12/1/2008 3:22:42 AM


I hope this will fix the page refreshing issue.

  protected void OnCommand_btnDelete(object sender, CommandEventArgs e)

    //For Delete record code here
    //Use below method to bind datasource to gridview



 private void PopulateGridControls()

       //Get the new list form Db and bind it to grid view
            grdView.DataSource = dsList;

Thanks & Regards
Sandeep Reddy Pasham
GGK Technologies, Hyd
~ Please remember to click Mark as Answer on this post if it helped you ~
12/1/2008 4:22:30 AM


You have to code like this.

After Row Delete procedure you have to rebind the GridView.

protected void gvShippers_RowDeleting(object sender, GridViewDeleteEventArgs e)
SqlConnection conn = new SqlConnection(
SqlCommand cmd = new SqlCommand(
"DELETE FROM [Shippers] WHERE (ShipperID = @ShipperID)",
cmd.Parameters.AddWithValue("ShipperID", gvShippers.DataKeys[e.RowIndex]["ShipperID"]);

try { conn.Open(); if (cmd.ExecuteNonQuery().Equals(1))
lblMessage.Text = String.Format(
"Shipper '{0}' successfully deleted.",

this.SetData(); // You have to write this line of code to Re-populate your GridView.Call your GridView Bind method here.
finally { conn.Close(); } }
"A conclusion is where you got tired of thinking.
Be different. Think "

Remember to click “Mark as Answer” on the post If you get answer from my post(s) !

Thanks Guys
12/1/2008 5:30:46 AM

 If you are using events available in the GridView, please re-bind the GridView in Row_Deleted Event with the updated DataBase.


If you are using any Delete Button explicitly, please re-bind the GridView in Button_Click event with the updated DataBase.

Achutha Krishnan

~ No one can do everything, but everyone can do something ~
12/1/2008 7:08:08 AM

Similar Artilces:

Page is not getting refreshed but my datagrid is getting refreshed how to refresh the page
Hi EveryOne, Im getting a problem here that my datgrid is getting refreshed for every Updation ,Edit,Cancel commands but the page is not getting refreshed so anybody can help me how a page gets refreshed in a button click in C# of Asp.Net.                            Thanx in Advance RuttsRatnakar Choudry,,Tension Nahi Leneka Apun Hai Nah... When you do an update on the DataGrid, for sure a postback happens! So how is it that the DataG...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

Getting Started with .net and a few questions
Hello I've done some asp and php programming along with various other languages in the past and slowing getting my head around .net.I have a small project of creating a Holiday Booking system on our Intranet and just trying to get the first part to work properly will hopefully get me sorted for the whole project. The Intranet is running on .net 2 and I prefer to use the VB code rather than C#. This is connecting to an SQL server.My initial page that I am trying to create is just for an admin user to view which dates in a table have been specified as Bank Holidays and be able to add ...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Getting started with JScript.NET
I'm a Javascript and Actionscript developer, and the thought of being able to do server-sides in something I know was too good to resist. Does anyone know some good tutorials for developing ASP.NET pages in JScript?  I can find lots of console code, but simple things are hard: like I can't even figure out how to print something out to the web page (just a string). What I'm really trying to do is access a database, verify a login, and print JSON out to the response.  What should I do to start?  Is there a better way to do this? (IE: using some JSON library already?). I'm commun...

Getting started .net website
Hi folks,Does anyone here know of a good website to just sit back and read for learning .net? Thanks in advance.Baldeep Right here... Click the Get Started and Learn sections here. Quite a few out there - - this one, has a lot of good videos -  also, but then, I might be a little prejudiced David WierMCP/ - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(P...

Getting Started Without VS.NET
Hi all, does anyone know how any online resources that can show me how to create web apps that include code-behind, and uer controls without using VS.NET? I have VS.NET in work, but would also like to do work at home, but cannot install VS.NET on my home laptop because I simply dont' have the space or processor power. Any online articles would be welcome, as will any open-source apps - I currently have SharpDevelop, but I find it unstable as it crashes my laptop alot of the time. Thanks Tryst Did you try Web Martix? It is a FREE tool from Microsoft.Regards, Narayana ...

Deleting Entries In Start page in VS .NET
hi, I just want to know is there any way i can remove the entries in the start page of VS .NET. I deleted a few project but they still show up in the start page which i feel sometimes annoying .. is there any way i can remove those entries Thanks, ImranU and I Solutions, Did you ever get this figured out? I would sure like to remove some of mine. Mark I think the following post has the answer. The entries are stored in a registry key that you can modify. McBrideThis posti...

Newbie Question
I have a new project which has just started. One of the requirements is to generate XML files. Do I have to create schema files? Does anyone have a tutorial or sample code to help me get started. I have some background using XML, but not in .NET. Thx Mark How to create a new xml file with XmlDocument? More examples hereSonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum Thanks, this is very helpful. What do I need to do extra to setup the schema for this xml file? Is the schema really necessary as well? Thx Mark You dont need to define any sc...

Have delete compatibility.ini each time to get application to start.
My component needs boost libraries to run on the MAC. The problem is that the boost lib will not load unless it in placed in MacOS folder of bundle and not the components folder or xul framework folder. This causes a problem because in order to get the application to start, the compatibility.ini file in the profile has to be deleted each time. If the compatibility.ini exists then the application does not start Compatibility] LastVersion=XXX_20080922150017/2008071117 LastOSABI=Darwin_x86-gcc3 LastPlatformDir=/Applications/ XUL.framework LastAp...

Getting started with mySQL Connector/Net 5.1
i have a vs2005 project which someone else built.  I need to connect to mySQL in this project. it is currently using the OleDbConnection to mySQL and I cannot make the connection, so I was told by the developer to try the the mySQL Connector/Net 5.1.  I have read the very encouraging documentation.  I am in a file called SqlDataProvider.vbI want to replace Dim objConnection As OleDbConnectionwithDim objConnection As MySqlConnection I get the blue squiggly  "MySqlConncection is undefined." I added this import to the top. Imports MySql.Da...

Getting started with .net mobile/wireless application programming
Hi friends, I am very much amateur to the world of mobile/wireless application programming that's why m is having thousands of doubts and confusion regarding the technology. My first few concerns about the terms i.e. mobile web applications vs. windows mobile applications first thing are these 2 things are same if not what are the main differences. I hope you will also show me some light how to move further ahead in this field as i m having small exp approx. 1.5 yrs in application. Any help in the form of links, URL, code will be highly appreciated. Thanks in advanced...

getting start with and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

Web resources about - refresh after delete -

Refresh rate - Wikipedia, the free encyclopedia
The refresh rate (most commonly the "vertical refresh rate", "vertical scan rate" for CRTs ) is the number of times in a second that a display ...

Facebook Allowing Page Admins To ‘Refresh Share Attachment?’
Facebook appears to have given page administrators the option of refreshing links that they share in posts on their pages . continued... New ...

The article requested cannot be found! Please refresh your browser or go back. (CP,20120705,,-1,AR). delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and ...

Crispin Porter and Refresh Partners Launch Whopper Sacrifice App for Burger King
... has been making the rounds through Facebook’s News Feed today. Why? A new application from Crispin Porter + Bogusky and Toronto-based Refresh ... gets a refresh
Every month, hundreds of millions of people come to Twitter to see what’s happening in the world. After all, it’s often the best place to turn ...

Refresh - Insight on People You Meet on the App Store on iTunes
Get Refresh - Insight on People You Meet on the App Store. See screenshots and ratings, and read customer reviews.

Maine's First Ship Pepsi Refresh Video.m4v - YouTube
Maine's First Ship Pepsi Refresh Video.

IN PICTURES: Fujitsu's 2012 notebook refresh
New addition consists of a new Ultrabook in the Lifebook U series

Refresh your tiles to refresh your bathroom
Refresh your tiles to refresh your bathroom

Aldi supermarket refresh: Will fancier stores make Aldi more expensive?
ALDI has finally decided to invest a bit of money and refresh its supermarkets. Someone at the famously frugal German retailer has decided looking ...

Resources last updated: 11/30/2015 2:28:37 PM