Professional Web Applications Themes

Events in Custom Controls and Sub Classes - ASP.NET Building Controls

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 ...

  1. #1

    Default Events in Custom Controls and Sub Classes

    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
    Reiner Max Guest

  2. #2

    Default Re: Events in Custom Controls and Sub Classes

    Reiner Max" <reinermaxuni.de> wrote in message
    news:18kyh3b03mk4l$.13os3md5xmyrn$.dlg40tude.net. ..
    > 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


    John Saunders Guest

Similar Threads

  1. communication between an application, custom controls, and user controls
    By Beatniks in forum ASP.NET Building Controls
    Replies: 2
    Last Post: December 17th, 10:11 PM
  2. Replies: 1
    Last Post: November 25th, 03:15 PM
  3. Controls events not firing
    By Mike in forum ASP.NET Building Controls
    Replies: 1
    Last Post: February 24th, 02:24 PM
  4. Composite custom controls events
    By apple in forum ASP.NET Building Controls
    Replies: 9
    Last Post: February 9th, 08:45 PM
  5. Accessing Properties of Custom Controls child Controls
    By Moldy in forum ASP.NET Building Controls
    Replies: 8
    Last Post: September 5th, 03:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139