Link to home
Start Free TrialLog in
Avatar of rutledgj
rutledgj

asked on

raising events in usercontrol

I have a content page that will contain a couple of updatepanels with usercontrols in them. In one usercontrol (ucHieReport) I'm raising an event (ShowSelectedCellMessage(CellMessage As String)).

In my content page I have a sub to show a popup message to the user (Protected Sub ShowMasterPageMessageWindow(Message As String)).

What I don't know is how to wire the event in the control up to the content page.

The content markup is this:
<asp:UpdatePanel ID="upReports" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <uc:HieReport runat="server" ID="ucHieReport" OnErrorOccurred="HandleUserControlErrors" />
        </ContentTemplate>
    </asp:UpdatePanel>

Open in new window



usercontrol codebehind:

 Public Event ShowSelectedCellMessage(CellMessage As String)




In the codebehind of the content page if I do this  ucHieReport.  the intellisense does not show the event declared in the user control. I would think it should.
Avatar of Rajar Ahmed
Rajar Ahmed
Flag of India image

Avatar of rutledgj
rutledgj

ASKER

Well, that might work for a button but I don't see how I can incorporate that into how I'm raising the event.

In the control I have a gridview. On that gridview's RowCommand event I'm trying to raise the ShowSelectedCellMessage event.

So in the page load of the control, how do you add the new event to that (gvHIE_RowCommand)?


 Protected Sub gvHIE_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvHIE.RowCommand

        Dim _gridView As GridView = CType(sender, GridView)
        _gridView.EditIndex = -1
        RaiseEvent ShowSelectedCellMessage(e.CommandArgument.ToString)
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rajar Ahmed
Rajar Ahmed
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial