Professional Web Applications Themes

add events to dropdown list in custom server control - ASP.NET Building Controls

Hi, It is easy to add an event to a hyperbutton, but what about a dropdownlist ? This is what I've implemented for the hyperbutton: lblHyper.CommandName = "H" & i lblHyper.CommandArgument = "Test" AddHandler lblHyper.Click, AddressOf Me.ButtonClick Now I want to have a kind of event like a lostfocus or changed event on the dropdownlist is that possible ? Ton...

  1. #1

    Default add events to dropdown list in custom server control

    Hi,
    It is easy to add an event to a hyperbutton, but what about a dropdownlist ?

    This is what I've implemented for the hyperbutton:
    lblHyper.CommandName = "H" & i

    lblHyper.CommandArgument = "Test"

    AddHandler lblHyper.Click, AddressOf Me.ButtonClick

    Now I want to have a kind of event like a lostfocus or changed event on the
    dropdownlist

    is that possible ?

    Ton






    ton Guest

  2. #2

    Default Re: add events to dropdown list in custom server control

    simply do what you did with your button, and do not forget to set the
    autopsotback to true for your dropdownlist. If you rem, a dropdownlist can
    postback and therefore raise a postback event like your button when an item
    is selected ;P
    dropdownlist1.AutoPostBack = True

    "ton" <vrshome.nl> wrote in message
    news:bvomp4$qbq$1news4.tilbu1.nb.home.nl...
    > Hi,
    > It is easy to add an event to a hyperbutton, but what about a dropdownlist
    ?
    >
    > This is what I've implemented for the hyperbutton:
    > lblHyper.CommandName = "H" & i
    >
    > lblHyper.CommandArgument = "Test"
    >
    > AddHandler lblHyper.Click, AddressOf Me.ButtonClick
    >
    > Now I want to have a kind of event like a lostfocus or changed event on
    the
    > dropdownlist
    >
    > is that possible ?
    >
    > Ton
    >
    >
    >
    >
    >
    >

    Alessandro Zifiglio Guest

  3. #3

    Default Re: add events to dropdown list in custom server control

    but what event can be used for the dropdownlist

    cmbField.SelectedIndexChanged like

    AddHandler cmbField.SelectedIndexChanged, AddressOf Me.BasicBrowse



    in basicbrowse I just show something like

    Private Sub basicBrowse(ByVal sender As Object, ByVal e As System.EventArgs)

    context.Response.Write("the event ")

    End Sub





    "Alessandro Zifiglio" <alessandrozifiglioNO-SPAM-hotmail.com> schreef in
    bericht news:ZERTb.3100$HO2.825news.edisontel.com...
    > simply do what you did with your button, and do not forget to set the
    > autopsotback to true for your dropdownlist. If you rem, a dropdownlist can
    > postback and therefore raise a postback event like your button when an
    item
    > is selected ;P
    > dropdownlist1.AutoPostBack = True
    >
    > "ton" <vrshome.nl> wrote in message
    > news:bvomp4$qbq$1news4.tilbu1.nb.home.nl...
    > > Hi,
    > > It is easy to add an event to a hyperbutton, but what about a
    dropdownlist
    > ?
    > >
    > > This is what I've implemented for the hyperbutton:
    > > lblHyper.CommandName = "H" & i
    > >
    > > lblHyper.CommandArgument = "Test"
    > >
    > > AddHandler lblHyper.Click, AddressOf Me.ButtonClick
    > >
    > > Now I want to have a kind of event like a lostfocus or changed event on
    > the
    > > dropdownlist
    > >
    > > is that possible ?
    > >
    > > Ton
    > >
    > >
    > >
    > >
    > >
    > >
    >
    >

    ton Guest

  4. #4

    Default Re: add events to dropdown list in custom server control

    Go to
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsdropdownlistmemberstopi c.asp[/url]
    and scroll down to the "Public Events" section.

    "ton" <vrshome.nl> wrote in message
    news:bvtqjp$va1$1news4.tilbu1.nb.home.nl...
    > but what event can be used for the dropdownlist
    >
    > cmbField.SelectedIndexChanged like
    >
    > AddHandler cmbField.SelectedIndexChanged, AddressOf Me.BasicBrowse
    >
    >
    >
    > in basicbrowse I just show something like
    >
    > Private Sub basicBrowse(ByVal sender As Object, ByVal e As
    System.EventArgs)
    >
    > context.Response.Write("the event ")
    >
    > End Sub
    >
    >
    >
    >
    >
    > "Alessandro Zifiglio" <alessandrozifiglioNO-SPAM-hotmail.com> schreef in
    > bericht news:ZERTb.3100$HO2.825news.edisontel.com...
    > > simply do what you did with your button, and do not forget to set the
    > > autopsotback to true for your dropdownlist. If you rem, a dropdownlist
    can
    > > postback and therefore raise a postback event like your button when an
    > item
    > > is selected ;P
    > > dropdownlist1.AutoPostBack = True
    > >
    > > "ton" <vrshome.nl> wrote in message
    > > news:bvomp4$qbq$1news4.tilbu1.nb.home.nl...
    > > > Hi,
    > > > It is easy to add an event to a hyperbutton, but what about a
    > dropdownlist
    > > ?
    > > >
    > > > This is what I've implemented for the hyperbutton:
    > > > lblHyper.CommandName = "H" & i
    > > >
    > > > lblHyper.CommandArgument = "Test"
    > > >
    > > > AddHandler lblHyper.Click, AddressOf Me.ButtonClick
    > > >
    > > > Now I want to have a kind of event like a lostfocus or changed event
    on
    > > the
    > > > dropdownlist
    > > >
    > > > is that possible ?
    > > >
    > > > Ton
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    >
    >

    marc Guest

Similar Threads

  1. Replies: 1
    Last Post: September 6th, 03:31 PM
  2. how to add events to a custom control
    By John Saunders in forum ASP.NET Building Controls
    Replies: 0
    Last Post: July 24th, 11:18 PM
  3. Custom Server Control Events
    By Chris Kennedy in forum ASP.NET Building Controls
    Replies: 0
    Last Post: April 6th, 08:56 PM
  4. dropdown list in custom control not persiting databind
    By Joel Barsotti in forum ASP.NET Building Controls
    Replies: 1
    Last Post: January 16th, 07:50 PM
  5. Events for a custom server control
    By John Saunders in forum ASP.NET General
    Replies: 0
    Last Post: August 8th, 05:52 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