Dynamic separator row causing ButtonColumn event wiring problems

Z

zigjog

Hello,

I have been attempting to create a Datagrid that inserts a separator row
between databound rows using code recommended by DataGrid Girl in this post
(http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&newwindow=1&safe=off&fra
me=right&th=62db3580fd5c42b6&seekm=efzXR7L0CHA.2736%40TK2MSFTNGP09#link4)

This works great until I try to start using ButtonColumns in my datagrid.
When I use ButtonColumns in conjunction with this code to insert separators,
not all of my buttons fire the command event. Specifically, buttons toward
the bottom of the list tend to not work where buttons at the top of the list
do.

Let's take a simple example where I have a list of two items and each row
has a "Remove" link button at the end of it that I've defined with a
ButtonColumn. If I don't add the separator using the method described in
the link above, both buttons work as expected. If I do add the separators,
only the top button works.

If you look at the source of the HTML that is generated when I do not
include the separator, my link buttons are calling
javascript:__doPostBack('MyDataGrid:_ctl2:ctl0','') in the first row and
javascript:__doPostBack('MyDataGrid:_ctl3:ctl0','') in the second row. When
I do include the separator, the code for the 2nd button has now changed to
javascript:__doPostBack('MyDataGrid:_ctl4:ctl0',''). Notice how it's now
ctl4 instead of clt3.

I can only guess that the event wiring is taking place to ctl3 before I add
my separator and that ctl4 is never considered in the equation.

Does anyone have any suggestions for how I can get both the separator row
added to my datagrid and have my link button events fire as well?

Thanks.

Jamie
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top