DataList selection

Discussion in 'ASP .Net' started by Michael Groeger, Apr 6, 2005.

  1. Hi,

    I have a DataList which is filled with a custom control. The custom control
    contains a image and a label. The problem is that neither the
    SelectedIndexChanged event of the DataList is fired nor the SelectedItem
    template is shown (same custom control with different back color and fore
    color) when clicking on a control inside the DataList. What am I doing wrong
    here?

    Regards,
    Michael
    Michael Groeger, Apr 6, 2005
    #1
    1. Advertising

  2. Michael Groeger

    Scott Allen Guest

    Hi Michael:

    The SelectedIndexChanged event fires when the user selects a specific
    control in the list - not just any control. The general approach is
    for people to add a Button or an ImageButton to each row (think of it
    as the "Select" button, and wire the Select button to the
    SelectedIndexChanged event.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Wed, 6 Apr 2005 15:17:28 +0200, "Michael Groeger"
    <> wrote:

    >Hi,
    >
    >I have a DataList which is filled with a custom control. The custom control
    >contains a image and a label. The problem is that neither the
    >SelectedIndexChanged event of the DataList is fired nor the SelectedItem
    >template is shown (same custom control with different back color and fore
    >color) when clicking on a control inside the DataList. What am I doing wrong
    >here?
    >
    >Regards,
    >Michael
    >
    Scott Allen, Apr 6, 2005
    #2
    1. Advertising

  3. Hi Scott,

    so for my understanding, is it correct, that SelectedIndexChanged wires to
    the Button.Click event, it might help, if my custom control simply exposes a
    click event itself, which gets triggered, whenever a control inside is
    clicked?

    Regards,
    Michael

    "Scott Allen" <> schrieb im Newsbeitrag
    news:...
    > Hi Michael:
    >
    > The SelectedIndexChanged event fires when the user selects a specific
    > control in the list - not just any control. The general approach is
    > for people to add a Button or an ImageButton to each row (think of it
    > as the "Select" button, and wire the Select button to the
    > SelectedIndexChanged event.
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > On Wed, 6 Apr 2005 15:17:28 +0200, "Michael Groeger"
    > <> wrote:
    >
    > >Hi,
    > >
    > >I have a DataList which is filled with a custom control. The custom

    control
    > >contains a image and a label. The problem is that neither the
    > >SelectedIndexChanged event of the DataList is fired nor the SelectedItem
    > >template is shown (same custom control with different back color and fore
    > >color) when clicking on a control inside the DataList. What am I doing

    wrong
    > >here?
    > >
    > >Regards,
    > >Michael
    > >

    >
    Michael Groeger, Apr 6, 2005
    #3
  4. Michael Groeger

    Scott Allen Guest

    Yes, you could wire things up that way, too.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Wed, 6 Apr 2005 16:30:30 +0200, "Michael Groeger"
    <> wrote:

    >Hi Scott,
    >
    >so for my understanding, is it correct, that SelectedIndexChanged wires to
    >the Button.Click event, it might help, if my custom control simply exposes a
    >click event itself, which gets triggered, whenever a control inside is
    >clicked?
    >
    >Regards,
    >Michael
    >
    >"Scott Allen" <> schrieb im Newsbeitrag
    >news:...
    >> Hi Michael:
    >>
    >> The SelectedIndexChanged event fires when the user selects a specific
    >> control in the list - not just any control. The general approach is
    >> for people to add a Button or an ImageButton to each row (think of it
    >> as the "Select" button, and wire the Select button to the
    >> SelectedIndexChanged event.
    >>
    >> --
    >> Scott
    >> http://www.OdeToCode.com/blogs/scott/
    >>
    >> On Wed, 6 Apr 2005 15:17:28 +0200, "Michael Groeger"
    >> <> wrote:
    >>
    >> >Hi,
    >> >
    >> >I have a DataList which is filled with a custom control. The custom

    >control
    >> >contains a image and a label. The problem is that neither the
    >> >SelectedIndexChanged event of the DataList is fired nor the SelectedItem
    >> >template is shown (same custom control with different back color and fore
    >> >color) when clicking on a control inside the DataList. What am I doing

    >wrong
    >> >here?
    >> >
    >> >Regards,
    >> >Michael
    >> >

    >>

    >
    Scott Allen, Apr 6, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nevyn Twyll
    Replies:
    8
    Views:
    1,849
  2. Simon Niederberger
    Replies:
    2
    Views:
    16,452
    Christian Kaufhold
    Jan 7, 2005
  3. Andrew Crowe
    Replies:
    1
    Views:
    4,445
    Andrew Crowe
    Sep 13, 2004
  4. curiousity

    HOWTO autopost the selection list upon selection

    curiousity, Nov 21, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    260
    curiousity
    Nov 21, 2003
  5. Loebb
    Replies:
    0
    Views:
    193
    Loebb
    Feb 23, 2004
Loading...

Share This Page