Web User Control Events

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

This is driving me crazy -- I'm trying to raise an event
in a web user control and respond to it in a web page.
It's a datagrid in a Web User Control which sits in a
template column of another datagrid on a web page. I
believe I'm raising the event because the first trace.warn
("WriteName") in the control is executing. The Second
(trace.warn("Dave")) is not. Any ideas?

---------------------------------------------------

In the User Control:

Public Event WriteName(ByVal s As Object, ByVal e As
System.EventArgs)
...
...
Private Sub _grdTitles_EditCommand(ByVal source As
Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs)
Handles _grdTitles.EditCommand
trace.warn ("WriteName")
RaiseEvent WriteName(Me, e)
End Sub
------------------------------------------------------

In the web page aspx:

<uc1:TitlesGrid id=grdTitles runat="server"
TitlesDataSource='<%#container.dataitem.createchildview
("PublishersTitles")%>' TitlesDataMember="Titles" />

Web page Code:

Protected WithEvents MyTitles As TitlesGrid
...
...
Private Sub MyTitles_WriteName(ByVal s As Object, ByVal e
As System.EventArgs) Handles MyTitles.WriteName
Trace.Warn("Dave")
End Sub
 
I'm not sure but I think that the problem lies within the aspx/web page
code, you define a Titlesgrid called 'grdTitles' and then in code you define
a Titlesgrid called MyTitles, I believe you should use :

Protected WithEvents grdTitles As TitlesGrid



Kind regards,

Jurjen de Groot
Netherlands.
 
Back
Top