locked
Identify the source of handle in the Sub RRS feed

  • Question

  • User363578564 posted

    there are some codes for all the gridviews when row created

    How can i do to have some codes just for one of the Gridview in the same Sub?  Thanks.

    i tried "sender" or "e", seem not OK.

    Private Sub GVPart_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GVPart.RowCreated, GVEvent.RowCreated, GVActivity.RowCreated
    If e.Row.RowType = DataControlRowType.Header Then
                 do something for all here....
                  do something only for GVEvent.rowcreated here

    End If
    End Sub

    Tuesday, January 15, 2019 3:51 AM

Answers

  • User1120430333 posted

    I would think that you could cast sender  to a grid and check the name possibly, assuming that the event was a generic event method used by all grids..

    dim  thegrid = DirectCast(sender, gridview)
    
    if thegrid.name = "Grid1" then
         ' do something
    endif

       

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 15, 2019 4:48 AM

All replies

  • User1120430333 posted

    I would think that you could cast sender  to a grid and check the name possibly, assuming that the event was a generic event method used by all grids..

    dim  thegrid = DirectCast(sender, gridview)
    
    if thegrid.name = "Grid1" then
         ' do something
    endif

       

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 15, 2019 4:48 AM
  • User363578564 posted

    Thanks a lot.  It works.

    finally i used thegrid.ID

    Tuesday, January 15, 2019 6:05 AM