Much is buzzing on the internet about the wonderful "onClientClick" property which you can set for a LinkButton inside of an ItemTemplate of a GridView. Now I have seen Scott Guthrie and Fritz Onion writing about it. And I certainly love the ability to simply ask "window.confirm" in the on-client event for the "Delete" button for example. But I am wondering can I do this for some other use cases, such as when I have no SQLDataSource bound to the grid, just a DataSet pumped into it at Page Load, or I have an SQLDataSource but with only "Select" command defined?
I wonder if the onClientClick -> Confirm technique can apply for a regular button column, not part of an ItemTemplate?
Maybe this is no biggie, I have worked around it thusfar. Maybe GridViewGirl knows the answer?
Link to my question to Fritz Onion, ASP .NET expert.
I have found a way to the RowIndex of the item clicked, even if it is not marked up with standard CRUD database operation attributes.
Using :
((e.CommandSource as ImageButton).Parent.Parent as GridViewRow).RowIndex;
I can get to the DataKey I need in the array of DataKeys in the grid.
No comments:
Post a Comment