event not firing through raiseevent

here's the scenario
    <asp:repeater ......

    <asp:linkbutton ... ></asp:linkbutton>

in the behind code for the user control, i have
public event evQueue
public sub linkbutton_click (....) handles
    raiseevent evQueue
end sub

the problem on the first page, is im not able to catch this
i tried doing this
Private Sub QueueAct() handles usercontrol.evQueue

End Sub

but it doesnt fire it.. my guess is because the user control is in a repeater, so something must have to be done in the databound, any ideas?
Who is Participating?
try it with AutoEventWireup="true"
You need an EventHandler and to Raise it you do RaiseEvent(Me,e) where e is an EventArgs param

 Public Event Click As EventHandler
 Protected Overridable Sub OnClick(ByVal e As EventArgs)
     RaiseEvent Click(Me, e)
 End Sub
mocaivAuthor Commented:
didnt work

the code below doesnt work.. the testabc sub does not fire on raiseevent

Main Page
  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            Dim dt As New DataTable
            Dim dc As New DataColumn("abc")
            Dim dr As DataRow
            dr = dt.NewRow
            dr(0) = "test"

            Repeater1.DataSource = dt
        End If
    End Sub
    Public Sub testabc(ByVal sender As Object, ByVal e As EventArgs)

    End Sub
    Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
        AddHandler CType(e.Item.Controls(1), WebUserControl2).evA, AddressOf testabc
    End Sub

User Control:

   Public Event evA As EventHandler

    Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
        RaiseEvent evA(Nothing, Nothing)
    End Sub

main web (html)

<%@ Register TagPrefix="uc1" TagName="WebUserControl2" Src="WebUserControl2.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Test1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
            <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="">
      <body MS_POSITIONING="GridLayout">
            <form id="Form1" method="post" runat="server">
                  <asp:Repeater id="Repeater1" runat="server">
                              <uc1:WebUserControl2 id="WebUserControl21" runat="server"></uc1:WebUserControl2>

user control html  
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="WebUserControl2.ascx.vb" Inherits="Test1.WebUserControl2" TargetSchema="" %>
<asp:LinkButton id="LinkButton1" runat="server">LinkButton</asp:LinkButton>

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.