Need help on Refreshing grid after deleting a record

Joined
Dec 9, 2008
Messages
5
Reaction score
0
I have a dropwdown where I select a name from the dropdown list. This populates a grid view with that record. Once I select that record it will populate a form with textboxes of info for that record. There is a delete button in that form and when I click the delete button I want it to refresh the grid with that record removed from the grid. so it shows a blank grid or the grid minus that record. Does anyone know how to do this. Is this something handled in the code behind? Here is my code for the delete button on the design page:

Code:
<asp:button id="deleteButton" CommandName="Delete"    
                    style="background-image:url('Images/Button.gif'); text-align:center;background-color:Transparent; cursor:hand; background-repeat:no-repeat; background-position:left; padding-left:15px;"    
                    Runat="server" Height="25px" BorderStyle=None  ForeColor=White   Text="Delete"    
                    Width="99px" CssClass="style3" onclientclick="return confirm('Are you surely want to delete this record?');"  />

and I have used a databind to the grid on the page load and delete button event and neither has worked like this:


Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load



If Page.IsPostBack = False Then 

GridView1.DataBind()

End If 

End Sub

Code:
Protected Sub deleteButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)   
       
       GridView1.DataBind()   
  
       End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top