Client Script emitted from a Repeater Item Control

Discussion in 'ASP .Net' started by Joel Cade, Jul 16, 2003.

  1. Joel Cade

    Joel Cade Guest

    I'm using a repeater to show the rows in a data table. I'd like the
    have a link button beside each row that removes the record, firing a
    client script function to prompt the user for confirmation, and then
    run as a server control. I know how to attach client script to a
    server control, but I'm not sure how to access the control of the
    repeater item. Code follows:

    <ItemTemplate>
    <tr class="font8v">
    <td><%# DataBinder.Eval(Container.DataItem, "FileName")
    %></td>
    <td><%# DataBinder.Eval(Container.DataItem, "Size"))%></td>
    <td><asp:LinkButton id="btnOne" runat="server" Text="Remove"
    CommandArgument='<%#DataBinder.Eval
    Container.DataItem,"FileName")%>' ></asp:LinkButton>
    </td>
    </tr>
    </ItemTemplate>

    To add client script to a button, I'd do the following:
    btnOne.Attributes.Add("onclick", "javascript:confirmRemove")

    How do I programmatically do this to the repeater Item?

    Thanks in advance for any help!!
     
    Joel Cade, Jul 16, 2003
    #1
    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. Replies:
    0
    Views:
    1,123
  2. TR
    Replies:
    1
    Views:
    433
    Bruce Barker
    May 24, 2005
  3. Howard
    Replies:
    5
    Views:
    1,168
    Eliyahu Goldin
    Mar 29, 2006
  4. =?Utf-8?B?RXJpYw==?=

    Repeater control -- Using e.Item.DataItem

    =?Utf-8?B?RXJpYw==?=, May 10, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    17,825
    ichi27
    Jun 2, 2011
  5. Paul
    Replies:
    0
    Views:
    396
  6. David Mathog
    Replies:
    2
    Views:
    417
    Dave Thompson
    Jul 11, 2005
  7. How do I stop this javascript from being emitted?

    , Sep 15, 2006, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    314
    Teemu Keiski
    Sep 17, 2006
  8. Replies:
    1
    Views:
    190
    gerry
    Sep 15, 2006
Loading...