Ask a Question related to ASP.NET General, Design and Development.
-
Nick Lewis #1
Catching events in web form fired by user control
I'm trying to process an event raised by a user control in the web
form
that contains that control. I've fathomed out how to handle the event
within the control but how can I then pass it on to the parent web
form?
Thanks,
Nick
Nick Lewis Guest
-
web user control events
I have an ascx web user control that has a button and listbox. I want to be able to expose the click event of the button and return the selected... -
Events of datagrid in user control not fired
Hi, I have a user control which contains a datagrid. The page hosting the user control passes to it the values, which the user control transforms... -
Know in user control page_load if an user control event is going to be fired
Hi all, i have built a user control that shows a map and let the user zoom in, out, usual stuff. Putting this object in a webform the user can... -
No events are fired in child control
I have developed a custom web control that may contain any child controls. Now I have a problem that even though I register an event handler on a... -
Page Load fired 3 times Web user control is embedded in a custom control
Hi, I have built a custom control that build a table with 3 cells in it. The custom control is designed to add all child controls to cell#2,... -
Gary McCormack #2
Catching events in web form fired by user control
You have a couple of ways of doing this. You can either
bubble the even using the RaiseBubbleEvent method in the
user control and overriding the OnBubbleEvent method in
the WebForm, or you can explicitly declare and raise an
event from your user control and catch it in your WebForm.
For example, if you wanted to ripple a Button click...
In UserControl:
....
Public Event SaveClicked(ByVal sender As Object, ByVal e
As System.EventArgs)
....
Private Sub btnSave_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles btnSave.Click
RaiseEvent SaveClicked(sender, e)
End Sub
In WebForm:
Private Sub MyUserControl_SaveClicked(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
MyUserControl.SaveClicked
'Do Something...
End Sub
That should work (although I've just type it from memory,
so there may be some syntax errors or typos...)
in the web>-----Original Message-----
>I'm trying to process an event raised by a user controlhandle the event>form
>that contains that control. I've fathomed out how toparent web>within the control but how can I then pass it on to the>form?
>
>Thanks,
>
>Nick
>.
>Gary McCormack Guest



Reply With Quote

