LinkButtons within a Repeater Control

Discussion in 'ASP .Net Web Controls' started by Majek, Nov 11, 2004.

  1. Majek

    Majek Guest

    I have created a repeater with a linkbutton for each databound item.

    When I fire off the repeater controls ItemCommand I execute the following...

    For indx = 0 To rpContacts.Items.Count - 1
    Dim btnMyContact As LinkButton =
    CType(rpContacts.Items(indx).FindControl("btnContact"), LinkButton)
    ....

    NEXT

    This works and I can access all of the properties of the linkbutton

    What I need to do is determine which linkbutton was clicked and then fire
    off a click event for that button.

    any suggestions?

    Gary T.
     
    Majek, Nov 11, 2004
    #1
    1. Advertisements

  2. Yes. Fire Command event and when you databind your repeater set linkbutton's
    CommandArgument and if you need more even CommandName. There should be only
    one command event handler for all linbuttons created this way and you will
    know by CommandArgument which one fired it.

    --
    RobertK
    { Clever? No just smart. }

    "Majek" <> wrote in message
    news:...
    > I have created a repeater with a linkbutton for each databound item.
    >
    > When I fire off the repeater controls ItemCommand I execute the

    following...
    >
    > For indx = 0 To rpContacts.Items.Count - 1
    > Dim btnMyContact As LinkButton =
    > CType(rpContacts.Items(indx).FindControl("btnContact"), LinkButton)
    > ...
    >
    > NEXT
    >
    > This works and I can access all of the properties of the linkbutton
    >
    > What I need to do is determine which linkbutton was clicked and then fire
    > off a click event for that button.
    >
    > any suggestions?
    >
    > Gary T.
    >
    >
     
    Robert Koritnik, Nov 12, 2004
    #2
    1. Advertisements

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. Darren Smith
    Replies:
    5
    Views:
    5,747
    dsmith
    May 10, 2004
  2. =?Utf-8?B?TWFqZWs=?=

    LinkButtons within Repeater control

    =?Utf-8?B?TWFqZWs=?=, Nov 11, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    507
    Scott Allen
    Nov 11, 2004
  3. Mark
    Replies:
    2
    Views:
    532
    Allen Chen [MSFT]
    Jan 21, 2009
  4. Jan Limpens

    How can I use working Linkbuttons within a Web Custom Control?

    Jan Limpens, Oct 14, 2003, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    283
    John Saunders
    Oct 14, 2003
  5. Wozza

    Creating LinkButtons in a Repeater ... in code.

    Wozza, Dec 8, 2006, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    313
    Wozza
    Dec 14, 2006
  6. Jan Limpens
    Replies:
    3
    Views:
    323
    Steve Drake
    Oct 15, 2003
  7. Brian Miller
    Replies:
    6
    Views:
    1,417
    Brian Miller
    Nov 18, 2004
  8. Jaime Stuardo

    How to access a server control within a repeater control

    Jaime Stuardo, Aug 19, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    282
    Jaime Stuardo
    Aug 19, 2006
Loading...