One item dropdowns

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon

    One item dropdowns

    I am using cascading dropdowns, where one dropdown determines the data in
    the next, etc...

    If a dropdown has only one item in it, the SelectedIndexCh anged event is
    never fired, even if you click on the dropdown and "reselect" the single
    item. This also happens when there are multiple items in the DD with the
    first item. You have to select another list item, then reselect the first
    one to have the event fire. I have it set to AutoPostBack, but obviously it
    is not in these situations. Is there a way to make the event happen in
    these situations.

    I tried the following (thinking it would force the user to select the item
    and fire the event), but it still selected the single item.

    ddTest.DataBind ()
    ddTest.Selected Index = -1

    Thanks

    --
    *************** *************** **
    Jon Rosenberg


  • Kevin Spencer

    #2
    Re: One item dropdowns

    Try adding a "-- Select Item --" item to the top of the list. That way,
    selecting even the only ONE (other) item in the dropdown causes a
    selectedIndex changed event.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Neither a follower
    nor a lender be.

    "Jon" <ruffles_@msn.c om> wrote in message
    news:10q95lp1fi icb97@corp.supe rnews.com...[color=blue]
    > I am using cascading dropdowns, where one dropdown determines the data in
    > the next, etc...
    >
    > If a dropdown has only one item in it, the SelectedIndexCh anged event is
    > never fired, even if you click on the dropdown and "reselect" the single
    > item. This also happens when there are multiple items in the DD with the
    > first item. You have to select another list item, then reselect the first
    > one to have the event fire. I have it set to AutoPostBack, but obviously[/color]
    it[color=blue]
    > is not in these situations. Is there a way to make the event happen in
    > these situations.
    >
    > I tried the following (thinking it would force the user to select the item
    > and fire the event), but it still selected the single item.
    >
    > ddTest.DataBind ()
    > ddTest.Selected Index = -1
    >
    > Thanks
    >
    > --
    > *************** *************** **
    > Jon Rosenberg
    >
    >[/color]


    Comment

    • Jon

      #3
      Re: One item dropdowns

      Thanks. Not the solution I was hoping for, but it certainly works.


      "Kevin Spencer" <kspencer@takem pis.com> wrote in message
      news:%23xE0QRj0 EHA.2716@TK2MSF TNGP14.phx.gbl. ..[color=blue]
      > Try adding a "-- Select Item --" item to the top of the list. That way,
      > selecting even the only ONE (other) item in the dropdown causes a
      > selectedIndex changed event.
      >
      > --
      > HTH,
      > Kevin Spencer
      > .Net Developer
      > Microsoft MVP
      > Neither a follower
      > nor a lender be.
      >
      > "Jon" <ruffles_@msn.c om> wrote in message
      > news:10q95lp1fi icb97@corp.supe rnews.com...[color=green]
      >> I am using cascading dropdowns, where one dropdown determines the data in
      >> the next, etc...
      >>
      >> If a dropdown has only one item in it, the SelectedIndexCh anged event is
      >> never fired, even if you click on the dropdown and "reselect" the single
      >> item. This also happens when there are multiple items in the DD with the
      >> first item. You have to select another list item, then reselect the
      >> first
      >> one to have the event fire. I have it set to AutoPostBack, but obviously[/color]
      > it[color=green]
      >> is not in these situations. Is there a way to make the event happen in
      >> these situations.
      >>
      >> I tried the following (thinking it would force the user to select the
      >> item
      >> and fire the event), but it still selected the single item.
      >>
      >> ddTest.DataBind ()
      >> ddTest.Selected Index = -1
      >>
      >> Thanks
      >>
      >> --
      >> *************** *************** **
      >> Jon Rosenberg
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • Martin Eyles

        #4
        Re: One item dropdowns

        Just thinking about this. Forgive me if this is a silly idea, but here goes.
        I get the impression that you don't want the "-- Select Item --" to show in
        the dropdown list. I would suggest including it as suggested, but setting
        the style atrribute to "visibility : hidden; height:0; width:0"

        ME

        "Jon" <ruffles_@msn.c om> wrote in message
        news:10q9gvbl4g b7hc5@corp.supe rnews.com...[color=blue]
        > Thanks. Not the solution I was hoping for, but it certainly works.
        >
        >
        > "Kevin Spencer" <kspencer@takem pis.com> wrote:-[color=green]
        > > Try adding a "-- Select Item --" item to the top of the list. That way,
        > > selecting even the only ONE (other) item in the dropdown causes a
        > > selectedIndex changed event.
        > >
        > >
        > > "Jon" <ruffles_@msn.c om> wrote:-[color=darkred]
        > >> I am using cascading dropdowns, where one dropdown determines the data[/color][/color][/color]
        in[color=blue][color=green][color=darkred]
        > >> the next, etc...
        > >>
        > >> If a dropdown has only one item in it, the SelectedIndexCh anged event[/color][/color][/color]
        is[color=blue][color=green][color=darkred]
        > >> never fired, even if you click on the dropdown and "reselect" the[/color][/color][/color]
        single[color=blue][color=green][color=darkred]
        > >> item. This also happens when there are multiple items in the DD with[/color][/color][/color]
        the[color=blue][color=green][color=darkred]
        > >> first item. You have to select another list item, then reselect the
        > >> first
        > >> one to have the event fire. I have it set to AutoPostBack, but[/color][/color][/color]
        obviously[color=blue][color=green]
        > > it[color=darkred]
        > >> is not in these situations. Is there a way to make the event happen in
        > >> these situations.
        > >>
        > >> I tried the following (thinking it would force the user to select the
        > >> item
        > >> and fire the event), but it still selected the single item.
        > >>
        > >> ddTest.DataBind ()
        > >> ddTest.Selected Index = -1[/color][/color][/color]

        --
        Martin Eyles
        martin.eyles@NO SPAM.bytronic.c om


        Comment

        Working...