Can we inject rows in a repeater control?

G

gnewsgroup

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.
 
C

Cowboy \(Gregory A. Beamer\)

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.
:)
 
B

bruce barker

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)
 
G

gnewsgroup

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?
 
G

gnewsgroup

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.
 
B

bruce barker

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

-- bruce (sqlwork.com)
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.
 
G

gnewsgroup

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?
 
C

Cowboy \(Gregory A. Beamer\)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top