Edit gridview modal popup

Last post 08-01-2009 6:50 AM by love13chess. 1 replies.

Sort Posts:

  • Edit gridview modal popup

    07-31-2009, 3:45 PM
    • Member
      24 point Member
    • kal30
    • Member since 03-01-2007, 7:03 PM
    • Posts 93

     I have a grid view with an edit button.  This pops a modal popup control.  My gridview does paging and sorting.

    I am able to edit fine but once the edit is done I need to refresh the page with new data.  I am not sure how to do that while maintaining my page.

    The one thing I tried was call the bind control in my close button of the modal popup

    Protected Sub btnclose_click(ByVal sender As Object, ByVal e As EventArgs)
       mdlPopup.Hide()
      BidGrid()
      End Sub
    But it does not seem to update the grid.  I am able to step through the code but the gridview is not updated
    Here is a snipet of my bind code

     

    Private pds As New PagedDataSource 
     Private Sub BindGrid()
        Dim _otimeMyTime As New clsTime
        Dim dt As DataTable = _otimeMyTime.GetProjects(10).Tables(0)
        Dim dv As DataView = dt.DefaultView
        If Not Me.ViewState("SortExp") Is Nothing Then
          dv.Sort = Me.ViewState("SortExp").ToString + " " + Me.ViewState("SortOrder").ToString
        End If
        pds.DataSource = dv
        pds.AllowPaging = True
        pds.PageSize = 10
        pds.CurrentPageIndex = CurrentPage
        lnkbtnNext.Enabled = Not pds.IsLastPage
        lnkbtnPrevious.Enabled = Not pds.IsFirstPage
        gvProjects.DataSource = pds
        gvProjects.DataBind()
        doPaging()
      End Sub
    

    Can someone please tell me what I am doing wrong.
    Thank you,
     

     


     

     

  • Re: Edit gridview modal popup

    08-01-2009, 6:50 AM
    Answer
    • Member
      75 point Member
    • love13chess
    • Member since 01-16-2006, 7:15 PM
    • Doral, FL
    • Posts 18

    Hi,

    Can you post the GridView code?

    Normally what you click on Edit the gridview will show two links or buttons (Update and Cancel). So when you click on Edit and input new values, you click on update. Then you bind the gridview again. There more than one way to do that depending on your code. If gvProjects is the GridView in question, then you should write code on the GridVIew RowUpdating event handler to updata your database using your own logic.


    Janier Davila

    "I would love to change the world, but they won’t give me the source code"
    ----------------------------------------------------
    Please remember to click “Mark as Answer” on the post that helped you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Page 1 of 1 (2 items)