Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Events in Custom Controls and Sub Classes

Reply
Thread Tools

Events in Custom Controls and Sub Classes

 
 
Reiner Max
Guest
Posts: n/a
 
      06-15-2004
Hello i try do this.

Class DemoBase
Public Delegate Sub DemoItemEventHandler(ByVal sender As Object, ByVal e _
As DemoItemEventArgs)

Public Event ItemCreated(ByVal e As DemoItemEventArgs)

Protected Sub OnItemCreated(ByVal e As DemoItemEventArgs)
RaiseEvent ItemCreated(e)
End Sub
End Class

So now I like to fire the event ItemCreated from this class

Class DemoItems
Function createDemoItems()
.............................
e.Control = td
OnItemCreated(e)
End Function
End Class

then I access this event from my aspx page

Sub DemoBuilder1_ItemCreated(ByVal sender As Object, ByVal e As
DemoBuilder.DemoItemEventArgs) Handles DemoBuilder1.ItemCreated
End Sub

My reason for this way is i can't access events in the class DemoItems
from my aspx page.

Thanks for help.

Max
 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      06-15-2004
Reiner Max" <> wrote in message
news:18kyh3b03mk4l$.13os3md5xmyrn$.. ..
> Hello i try do this.
>
> Class DemoBase
> Public Delegate Sub DemoItemEventHandler(ByVal sender As Object, ByVal e _
> As DemoItemEventArgs)
>
> Public Event ItemCreated(ByVal e As DemoItemEventArgs)


First of all, you want:

Public Event ItemCreated As DemoItemEventHandler


> Protected Sub OnItemCreated(ByVal e As DemoItemEventArgs)
> RaiseEvent ItemCreated(e)
> End Sub
> End Class
>
> So now I like to fire the event ItemCreated from this class
>
> Class DemoItems


Second, you need

Public Class DemoItems
Inherits DemoBase

Public Function createDemoItems() ' Get into the habit of specifying
accessability

> .............................
> e.Control = td
> OnItemCreated(e)
> End Function
> End Class
>
> then I access this event from my aspx page
>
> Sub DemoBuilder1_ItemCreated(ByVal sender As Object, ByVal e As
> DemoBuilder.DemoItemEventArgs) Handles DemoBuilder1.ItemCreated
> End Sub
>
> My reason for this way is i can't access events in the class DemoItems
> from my aspx page.


Exactly what error do you see or what problem do you have?
--
John Saunders
johnwsaundersiii at hotmail


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Death To Sub-Sub-Sub-Directories! Lawrence D'Oliveiro Java 92 05-20-2011 06:50 AM
databound custom controls vs composite databound custom controls rodchar ASP .Net 0 11-26-2007 03:51 PM
Recognising Sub-Items and sub-sub items using xslt Ben XML 2 09-19-2007 09:35 AM
runtime events that generate other controls and events newbye ASP .Net 0 07-06-2006 06:27 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57