Code behind and onclick on html table row

Discussion in 'ASP .Net Web Controls' started by Corno, Sep 3, 2004.

  1. Corno

    Corno Guest

    Hi all,

    I have a page with a table of which the rows have to be added dynamically.
    What I also want is 'code behind' the onclick event of a row (the page
    should be posted back to the server, which should handle the onclick).
    However, as the rows are added dynamically, I cannot give them an ID at
    designtime and attach a function to it. Is there a way to write one function
    for all added rows but that is able to distinguish which of the rows were
    clicked? Or is there another way to do this?

    TIA,

    Corno
    Corno, Sep 3, 2004
    #1
    1. Advertising

  2. Corno,

    You will have to use a client-side "onclick" event. You can pass it a
    parameter "this" which will refer to the clicked html table row.

    Eliyahu

    "Corno" <Corno@dds%FAKE%.nl> wrote in message
    news:...
    > Hi all,
    >
    > I have a page with a table of which the rows have to be added dynamically.
    > What I also want is 'code behind' the onclick event of a row (the page
    > should be posted back to the server, which should handle the onclick).
    > However, as the rows are added dynamically, I cannot give them an ID at
    > designtime and attach a function to it. Is there a way to write one

    function
    > for all added rows but that is able to distinguish which of the rows were
    > clicked? Or is there another way to do this?
    >
    > TIA,
    >
    > Corno
    >
    >
    Eliyahu Goldin, Sep 5, 2004
    #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. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    582
    Alphonse Giambrone
    Jun 28, 2003
  2. Corno
    Replies:
    2
    Views:
    22,184
    Eliyahu Goldin
    Sep 5, 2004
  3. phl
    Replies:
    1
    Views:
    4,346
    Martin Jay
    Jun 8, 2006
  4. Replies:
    0
    Views:
    474
  5. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    482
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
Loading...

Share This Page