Can we inject rows in a repeater control?

Discussion in 'ASP .Net' started by gnewsgroup, Oct 31, 2007.

  1. gnewsgroup

    gnewsgroup Guest

    OK, I am still trying to achieve something like what is shown in the
    following PNG image.

    http://farm3.static.flickr.com/2066/1808692173_ea202973a3_o.png

    I thought about doing this with a plain Table server control, but the
    problem is that this control does not provide enough events for us to
    identify the row in which the button is clicked.

    See a discussion I initiated in the following thread:

    http://groups.google.com/group/micr...d01e5/722b948a1e58d80d?hl=en#722b948a1e58d80d

    Now that the plain Table control does not seem to work, I am thinking
    of the repeater control. I know that the repeater control has an
    ItemCommand event, which will let us identify the row in which the
    button is clicked.

    But, is it possible to inject rows immediately below the row in which
    the Button Click event takes place? I haven't found anything about
    this question.
    gnewsgroup, Oct 31, 2007
    #1
    1. Advertising

  2. Yes, but it is generally done on binding, which may not solve your issue
    properly. If you can go this route, rebind the control on row click and then
    use the row data binding event to create a second row when you bind. I have
    not completed this particular task, so it may turn out to be a royal pain.
    :)

    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    *************************************************
    | Think outside the box!
    |
    *************************************************
    "gnewsgroup" <> wrote in message
    news:...
    > OK, I am still trying to achieve something like what is shown in the
    > following PNG image.
    >
    > http://farm3.static.flickr.com/2066/1808692173_ea202973a3_o.png
    >
    > I thought about doing this with a plain Table server control, but the
    > problem is that this control does not provide enough events for us to
    > identify the row in which the button is clicked.
    >
    > See a discussion I initiated in the following thread:
    >
    > http://groups.google.com/group/micr...d01e5/722b948a1e58d80d?hl=en#722b948a1e58d80d
    >
    > Now that the plain Table control does not seem to work, I am thinking
    > of the repeater control. I know that the repeater control has an
    > ItemCommand event, which will let us identify the row in which the
    > button is clicked.
    >
    > But, is it possible to inject rows immediately below the row in which
    > the Button Click event takes place? I haven't found anything about
    > this question.
    >
    Cowboy \(Gregory A. Beamer\), Oct 31, 2007
    #2
    1. Advertising

  3. gnewsgroup

    bruce barker Guest

    the table has enough events. the [+] can be a submit button with a
    command arg. you are going to need to track the state of the buttons on
    the serverside unles only one can be open at time.

    note: the most common approach is to actually render the hidden rows but
    set the display style to none. then javascript changes the style.

    -- bruce (sqlwork.com)

    gnewsgroup wrote:
    > OK, I am still trying to achieve something like what is shown in the
    > following PNG image.
    >
    > http://farm3.static.flickr.com/2066/1808692173_ea202973a3_o.png
    >
    > I thought about doing this with a plain Table server control, but the
    > problem is that this control does not provide enough events for us to
    > identify the row in which the button is clicked.
    >
    > See a discussion I initiated in the following thread:
    >
    > http://groups.google.com/group/micr...d01e5/722b948a1e58d80d?hl=en#722b948a1e58d80d
    >
    > Now that the plain Table control does not seem to work, I am thinking
    > of the repeater control. I know that the repeater control has an
    > ItemCommand event, which will let us identify the row in which the
    > button is clicked.
    >
    > But, is it possible to inject rows immediately below the row in which
    > the Button Click event takes place? I haven't found anything about
    > this question.
    >
    bruce barker, Oct 31, 2007
    #3
  4. gnewsgroup

    gnewsgroup Guest

    On Oct 31, 1:22 pm, "Cowboy \(Gregory A. Beamer\)"
    <> wrote:
    > Yes, but it is generally done on binding, which may not solve your issue
    > properly. If you can go this route, rebind the control on row click and then
    > use the row data binding event to create a second row when you bind. I have
    > not completed this particular task, so it may turn out to be a royal pain.
    > :)
    >


    Thank you. Well, there are two data sources: one for the export total
    and import total per year (what's shown before expanding), the other
    for the breakdown of a particular year (the expanded part), as shown
    in the image.

    Will the row data binding event know where I want to insert the newly
    created row?
    gnewsgroup, Oct 31, 2007
    #4
  5. gnewsgroup

    gnewsgroup Guest

    On Oct 31, 1:31 pm, bruce barker <> wrote:
    > the table has enough events. the [+] can be a submit button with a
    > command arg. you are going to need to track the state of the buttons on
    > the serverside unles only one can be open at time.
    >
    > note: the most common approach is to actually render the hidden rows but
    > set the display style to none. then javascript changes the style.
    >
    > -- bruce (sqlwork.com)
    >


    Thank you. Yes, I am aware that the [+] ImageButton can have a
    command argument, which I actually tried, but what do we assign to the
    CommandArgument property? Is there anyway to assign the row index to
    it? I know that the row index can be captured this way for a GridView.
    gnewsgroup, Oct 31, 2007
    #5
  6. gnewsgroup

    bruce barker Guest

    i assumed you'd set the command arg to the index, and assign the same
    handler to all the buttons.

    -- bruce (sqlwork.com)

    gnewsgroup wrote:
    > On Oct 31, 1:31 pm, bruce barker <> wrote:
    >> the table has enough events. the [+] can be a submit button with a
    >> command arg. you are going to need to track the state of the buttons on
    >> the serverside unles only one can be open at time.
    >>
    >> note: the most common approach is to actually render the hidden rows but
    >> set the display style to none. then javascript changes the style.
    >>
    >> -- bruce (sqlwork.com)
    >>

    >
    > Thank you. Yes, I am aware that the [+] ImageButton can have a
    > command argument, which I actually tried, but what do we assign to the
    > CommandArgument property? Is there anyway to assign the row index to
    > it? I know that the row index can be captured this way for a GridView.
    >
    bruce barker, Oct 31, 2007
    #6
  7. gnewsgroup

    gnewsgroup Guest

    On Oct 31, 2:14 pm, bruce barker <> wrote:
    > i assumed you'd set the command arg to the index, and assign the same
    > handler to all the buttons.
    >
    > -- bruce (sqlwork.com)
    >


    OK, so the problem loops back: How do we get the index of the row in
    which the button is clicked? In a GridView, we say
    Container.DataItemIndex. But what is it for a Table server control?
    gnewsgroup, Oct 31, 2007
    #7
  8. To the question, it is not automagic. You will have to pull the rows out
    with code to display the related data. The binding event will just allow you
    to examine each row bound until you get to the selected row and you will
    have to add the information.

    If the data is related, you can look at some of the examples people have
    done with hierarchical data controls. I believe Dino Esposito wrote one for
    MSDN magazine. Will have to check. This sounds like it might be more up your
    alley based on what you are doing.

    NOTE: You may also find the DataSource controls a bit unwieldy as you step
    outside of this box. They encapsulate a bit too much functionality when you
    start getting creative.


    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    *************************************************
    | Think outside the box!
    |
    *************************************************
    "gnewsgroup" <> wrote in message
    news:...
    > On Oct 31, 1:22 pm, "Cowboy \(Gregory A. Beamer\)"
    > <> wrote:
    >> Yes, but it is generally done on binding, which may not solve your issue
    >> properly. If you can go this route, rebind the control on row click and
    >> then
    >> use the row data binding event to create a second row when you bind. I
    >> have
    >> not completed this particular task, so it may turn out to be a royal
    >> pain.
    >> :)
    >>

    >
    > Thank you. Well, there are two data sources: one for the export total
    > and import total per year (what's shown before expanding), the other
    > for the breakdown of a particular year (the expanded part), as shown
    > in the image.
    >
    > Will the row data binding event know where I want to insert the newly
    > created row?
    >
    Cowboy \(Gregory A. Beamer\), Oct 31, 2007
    #8
    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. SamIAm
    Replies:
    5
    Views:
    5,646
    S. Justin Gengo
    Jan 7, 2004
  2. Imran Aziz

    deleting rows in repeater control

    Imran Aziz, Aug 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    10,717
    pwhe23
    Jun 30, 2008
  3. ~~~ .NET Ed ~~~
    Replies:
    1
    Views:
    132
    John Saunders
    Nov 3, 2004
  4. Peña, Botp

    inject does not inject last value

    Peña, Botp, Aug 7, 2006, in forum: Ruby
    Replies:
    4
    Views:
    171
    Peña, Botp
    Aug 7, 2006
  5. Replies:
    2
    Views:
    81
    nikki
    Oct 5, 2005
Loading...

Share This Page