Professional Web Applications Themes

ASP Dropdownlist events - ASP.NET General

Kerri, Use the drop down's SelectedIndexChanged Event. You should also set some type of text as the first item such as "Please Select". If you don't the user won't be able to fire the event for the first item in the list because the index won't be able to be changed to it (The first time at least). Then use a required field validator to keep the user from selecting the "Please Select" entry. Do so by setting the required field validator's InitialValue property to: "Please Select". Sincerely, -- S. Justin Gengo, MCP Web Developer Free code library at: [url]www.aboutfortunate.com[/url] ...

  1. #1

    Default Re: ASP Dropdownlist events

    Kerri,

    Use the drop down's SelectedIndexChanged Event.

    You should also set some type of text as the first item such as "Please
    Select". If you don't the user won't be able to fire the event for the first
    item in the list because the index won't be able to be changed to it (The
    first time at least).

    Then use a required field validator to keep the user from selecting the
    "Please Select" entry. Do so by setting the required field validator's
    InitialValue property to: "Please Select".

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "Kerri" <kerrinospam.com> wrote in message
    news:064101c35dcb$adfa9290$a001280aphx.gbl...
    > Hi,
    >
    > I have an asp dropdownlist. Depending on what the user
    > selects I want to make another text box visible.
    >
    > Is there no ONCLICK event for an asp dropdownlist so I
    > can check what the user selected and make the textbox
    > visible?
    >
    > Thanks,
    > Kerri.

    S. Justin Gengo Guest

  2. #2

    Default Re: ASP Dropdownlist events

    Thanks for that.

    Thats what I currently have.

    Yet my click event is not being called.

    Here is my drop down..


    <asp:DropDownList id="selCountry" Runat="server"
    style="width: 140px">

    <asp:ListItem value="US"
    selected="True">US</asp:ListItem>

    <asp:ListItem value="Canada">Canada</asp:ListItem>

    <asp:ListItem value="Other">Other</asp:ListItem>

    </asp:DropDownList>


    and here is the event...


    Sub selCountry_SelectedIndexChanged(ByVal sender As
    System.Object, ByVal e As System.EventArgs) Handles
    selCountry.SelectedIndexChanged
    If selCountry.SelectedIndex = ("Other") Then
    txOther.Visible = True
    End If
    End Sub

    Any ideas??
    >-----Original Message-----
    >Kerri,
    >
    >Use the drop down's SelectedIndexChanged Event.
    >
    >You should also set some type of text as the first item
    such as "Please
    >Select". If you don't the user won't be able to fire the
    event for the first
    >item in the list because the index won't be able to be
    changed to it (The
    >first time at least).
    >
    >Then use a required field validator to keep the user
    from selecting the
    >"Please Select" entry. Do so by setting the required
    field validator's
    >InitialValue property to: "Please Select".
    >
    >Sincerely,
    >
    >--
    >S. Justin Gengo, MCP
    >Web Developer
    >
    >Free code library at:
    >[url]www.aboutfortunate.com[/url]
    >
    >"Out of chaos comes order."
    > Nietzche
    >
    >
    >"Kerri" <kerrinospam.com> wrote in message
    >news:064101c35dcb$adfa9290$a001280aphx.gbl...
    >> Hi,
    >>
    >> I have an asp dropdownlist. Depending on what the user
    >> selects I want to make another text box visible.
    >>
    >> Is there no ONCLICK event for an asp dropdownlist so I
    >> can check what the user selected and make the textbox
    >> visible?
    >>
    >> Thanks,
    >> Kerri.
    >
    >
    >.
    >
    Kerri Guest

  3. #3

    Default Re: ASP Dropdownlist events

    Kerri,

    Are you posting back with a button or using the drop down's auto post back?

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "Kerri" <kerrinospam.com> wrote in message
    news:0b7e01c35dd1$fb8a78d0$a601280aphx.gbl...
    > Thanks for that.
    >
    > Thats what I currently have.
    >
    > Yet my click event is not being called.
    >
    > Here is my drop down..
    >
    >
    > <asp:DropDownList id="selCountry" Runat="server"
    > style="width: 140px">
    >
    > <asp:ListItem value="US"
    > selected="True">US</asp:ListItem>
    >
    > <asp:ListItem value="Canada">Canada</asp:ListItem>
    >
    > <asp:ListItem value="Other">Other</asp:ListItem>
    >
    > </asp:DropDownList>
    >
    >
    > and here is the event...
    >
    >
    > Sub selCountry_SelectedIndexChanged(ByVal sender As
    > System.Object, ByVal e As System.EventArgs) Handles
    > selCountry.SelectedIndexChanged
    > If selCountry.SelectedIndex = ("Other") Then
    > txOther.Visible = True
    > End If
    > End Sub
    >
    > Any ideas??
    > >-----Original Message-----
    > >Kerri,
    > >
    > >Use the drop down's SelectedIndexChanged Event.
    > >
    > >You should also set some type of text as the first item
    > such as "Please
    > >Select". If you don't the user won't be able to fire the
    > event for the first
    > >item in the list because the index won't be able to be
    > changed to it (The
    > >first time at least).
    > >
    > >Then use a required field validator to keep the user
    > from selecting the
    > >"Please Select" entry. Do so by setting the required
    > field validator's
    > >InitialValue property to: "Please Select".
    > >
    > >Sincerely,
    > >
    > >--
    > >S. Justin Gengo, MCP
    > >Web Developer
    > >
    > >Free code library at:
    > >[url]www.aboutfortunate.com[/url]
    > >
    > >"Out of chaos comes order."
    > > Nietzche
    > >
    > >
    > >"Kerri" <kerrinospam.com> wrote in message
    > >news:064101c35dcb$adfa9290$a001280aphx.gbl...
    > >> Hi,
    > >>
    > >> I have an asp dropdownlist. Depending on what the user
    > >> selects I want to make another text box visible.
    > >>
    > >> Is there no ONCLICK event for an asp dropdownlist so I
    > >> can check what the user selected and make the textbox
    > >> visible?
    > >>
    > >> Thanks,
    > >> Kerri.
    > >
    > >
    > >.
    > >

    S. Justin Gengo Guest

Similar Threads

  1. Composite Control with Templates - DropDownList bubble events
    By Marc Castrechini in forum ASP.NET Building Controls
    Replies: 6
    Last Post: September 29th, 09:23 AM
  2. DropDownList
    By Mira Vizjak in forum ASP.NET General
    Replies: 16
    Last Post: July 28th, 03:17 PM
  3. Dropdownlist help please
    By Gomack in forum Dreamweaver AppDev
    Replies: 1
    Last Post: April 11th, 10:28 AM
  4. Add a dropDownList
    By Steph in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: January 6th, 04:55 PM
  5. how to fire events of dropdownlist in datagrid
    By Balaji in forum ASP.NET General
    Replies: 1
    Last Post: June 26th, 12:57 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