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(C ellMessage As String)).
In my content page I have a sub to show a popup message to the user (Protected Sub ShowMasterPageMessageWindo w(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:
usercontrol codebehind:
Public Event ShowSelectedCellMessage(Ce llMessage 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.
In my content page I have a sub to show a popup message to the user (Protected Sub ShowMasterPageMessageWindo
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>
usercontrol codebehind:
Public Event ShowSelectedCellMessage(Ce
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.
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)?
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://justgeeks.blogspot.in/2009/09/custom-event-for-your-aspnet-user.html