G
Guest
I would like to move the Delete button such that it displays one time in the
footer row, rather than on every row. I've seen lots of questions asked on
the subject around the net, but no answer that seems to solve the problem.
I have tried a few things:
- adding a button, setting it's command name to Delete. Problem with this
is that the CommandArgument value does not get set to the SelectedIndex of
the GridView. Instead it has the value of an empty string. I've tried
binding the CommandArgument to the GridView.SelectedIndex, but that doesn't
seem to work, and I later read that the footer might not support data binding.
- writing javascript to this same button's "onClick" event, basically
replicating the __doPostBack... call that can be found with each inline
Delete button. This method regularly reloads the page, but for some reason I
cannot determine, it only once in a while decides that it wants to delete the
record. The rest of the time, nothing happens but a page reload.
I'm using Visual Web Developer 2005 Express edition, if that makes any
difference.
As a last resort, I'm considering adding some code that will manually call a
delete stored procedure, and manually rebind the GridView, but it was my hope
that I could leverage the SqlDataSource control and GridView control to
perform the work. However, if what I'm trying cannot be done, then I'll
accept that answer, too.
Any ideas, or questions for clarification (or code snippets)?
Thanks in advance,
Jason
footer row, rather than on every row. I've seen lots of questions asked on
the subject around the net, but no answer that seems to solve the problem.
I have tried a few things:
- adding a button, setting it's command name to Delete. Problem with this
is that the CommandArgument value does not get set to the SelectedIndex of
the GridView. Instead it has the value of an empty string. I've tried
binding the CommandArgument to the GridView.SelectedIndex, but that doesn't
seem to work, and I later read that the footer might not support data binding.
- writing javascript to this same button's "onClick" event, basically
replicating the __doPostBack... call that can be found with each inline
Delete button. This method regularly reloads the page, but for some reason I
cannot determine, it only once in a while decides that it wants to delete the
record. The rest of the time, nothing happens but a page reload.
I'm using Visual Web Developer 2005 Express edition, if that makes any
difference.
As a last resort, I'm considering adding some code that will manually call a
delete stored procedure, and manually rebind the GridView, but it was my hope
that I could leverage the SqlDataSource control and GridView control to
perform the work. However, if what I'm trying cannot be done, then I'll
accept that answer, too.
Any ideas, or questions for clarification (or code snippets)?
Thanks in advance,
Jason