ASP.net Where do I put AddHandler code

Murray Brown
Murray Brown used Ask the Experts™
on
Hi. In my ASP.net project I need to add a handler as follows.  Where should I put this? In the page load event?

' Hook up RowIslandDataBound event
AddHandler Me.WebHierarchicalDataGrid1.RowIslandDataBound, AddressOf WebHierarchicalDataGrid1_RowIslandDataBound
Protected Sub WebHierarchicalDataGrid1_RowIslandDataBound(ByVal sender As Object, ByVal e As RowIslandEventArgs) Handles WebHierarchicalDataGrid1.RowIslandDataBound
   If e.RowIsland.DataMember = "SqlDataSource1_DefaultView" Then
      ' Access a PARENT cell value
      Dim cellValue As String = e.RowIsland.Rows(0).Items(1).Value.ToString()
   End If
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Information Services Manager
Commented:
Yes, you can put it in the page_load event, and also make sure it is declared "With Events".

I assume you are creating this control dynamically in code.. correct?
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks Ron. This is to catch a cell change event in an Infragistics webdatagrid so when you say "creating this control dynamically" I assume you are referring to adding the handler
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial