ImageButton, Repeater and ItemDataBound

Discussion in 'ASP .Net' started by RicercatoreSbadato, Oct 1, 2006.

  1. I've put an ImageButton control in a repeater.
    I've set the 'OnItemBound' event of the repeater.

    Why when I click on the ImageButton it doesn't work?
    What else I have to do ?
     
    RicercatoreSbadato, Oct 1, 2006
    #1
    1. Advertising

  2. Did you wire up the button? You use events such as the OnItemBound to wire
    up the controls yourself. In the code for your OnItemBound event, you'll
    need to first find the control, then set the appropriate event handler for
    the Image Button event that you want it to handle. Usually in a repeater
    scenario I use the command event that way I can set a commandargument and
    commandname with a value relevant to the record. Some code may look like

    (ImageButton) myButton = (ImageButton)e.Item.FindControl("myButton");
    myButton.Command = ((DbDataRecord)e.Item.DataItem).GetString(0);
    myButton.CommandArgument = ((DbDataRecord)e.Item.DataItem).GetString(1);

    myButton.Command += my command event handler


    --
    Hope this helps,
    Mark Fitzpatrick
    Former Microsoft FrontPage MVP 199?-2006


    "RicercatoreSbadato" <> wrote in message
    news:...
    > I've put an ImageButton control in a repeater.
    > I've set the 'OnItemBound' event of the repeater.
    >
    > Why when I click on the ImageButton it doesn't work?
    > What else I have to do ?
    >
     
    Mark Fitzpatrick, Oct 2, 2006
    #2
    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. René Paschold

    Re: ItemDataBound in Repeater: FYI

    René Paschold, Oct 14, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    435
    René Paschold
    Oct 16, 2003
  2. Josh Daws
    Replies:
    2
    Views:
    22,303
    Claes
    Sep 11, 2006
  3. =?Utf-8?B?S2V2aW4gSGVjdG9y?=

    Repeater ItemCreated vs ItemDataBound

    =?Utf-8?B?S2V2aW4gSGVjdG9y?=, Apr 11, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,200
    Teemu Keiski
    Apr 11, 2004
  4. Darren Clark
    Replies:
    2
    Views:
    903
    Darren Clark
    Aug 31, 2004
  5. Dennis E. Jones, Jr.

    Repeater - ItemDataBound and ItemCreated

    Dennis E. Jones, Jr., Nov 18, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    15,985
    Dennis E. Jones, Jr.
    Nov 18, 2005
Loading...

Share This Page