Need help on Refreshing grid after deleting a record

Discussion in '.NET' started by mldardy, Oct 4, 2010.

  1. mldardy

    mldardy

    Joined:
    Dec 9, 2008
    Messages:
    5
    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 
    mldardy, Oct 4, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adam Sandler
    Replies:
    3
    Views:
    465
    Adam Sandler
    Jun 2, 2006
  2. Harlan Messinger

    Self-refreshing and non-self-refreshing controls

    Harlan Messinger, Aug 4, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    445
    =?Utf-8?B?Y2xpY2tvbg==?=
    Aug 4, 2006
  3. Harry Barker
    Replies:
    2
    Views:
    504
    Alf P. Steinbach
    Apr 19, 2006
  4. Harlan Messinger

    Self-refreshing and non-self-refreshing controls

    Harlan Messinger, Aug 3, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    179
    Harlan Messinger
    Aug 3, 2006
  5. crea
    Replies:
    2
    Views:
    397
    Nobody
    Dec 28, 2012
Loading...

Share This Page