Datagrid column buttons disappear on databind
I created an application with a datagrid that allows users to place an entire column in edit mode. There is also a hyperlink column that
allows them to drilldown to a more detailed datagrid.
The editable columns are template columns and I defined edit, update and cancel buttons for the template column's footer. Initially, the edit button is visible in the footer. When the edit button is clicked, every cell in the column hides its label and unhides a textbox through the itemcreated event so that the column is in edit
mode. In the itemcommand event, I hide the edit button in the footer
and display the update and cancel buttons. This works very well and I am able to change the data and update the entire column.
I wanted to be able to stop users from clicking on the hyperlink column while a column is in edit mode. So when the edit button is clicked, I change the hyperlink url to a Javascipt alert command for each row through the itemcreated event. But in order to get the alert reflected in the datagrid, I need to bind the data. And the alert works perfectly, clicking on the hyperlink displays a message telling the user that drilldown is not allowed in edit mode. The problem is when I bind the data, I lose the update and cancel buttons and the edit button appears in the column that's in edit mode. If I don't bind the data, the update and cancel buttons are there, but the hyperlink column reflects the original url and not the javascript alert command. It doesn't matter whether I place the databind command before or after I make the update and cancel buttons visible. I can confirm in debug mode that they are set to visible, yet they do not appear.
I've searched forums, newsgroups, msdn, etc. and but can't figure it out. Does anyone have any ideas how I can get this to work? Is there a different approach I can take?
|