C
Craig S
I believe the problem is definately a lack of understanding on my part about
how postbacks work, but here goes...
In my Page_Load method I bind my data from a SQL database to a datagrid -
works great... I've now created a button and in the OnClick method I do a
"DELETE FROM tablename WHERE keyfield=" +variablename (deletes several
records based on which checkboxes are checked in the datagrid).
The problem is that when the page posts back, the DELETE happens in the
database, but it obviously happens after the SELECT statement that populates
the datagrid. I check the DB contents and the records were indeed deleted,
but the datagrid is always one postback behind (If I post the page back
AGAIN, it will get the update)
What code can I add to make sure the datagrid gets bound AFTER the delete
command happens?
Thanks in advance!
Craig
how postbacks work, but here goes...
In my Page_Load method I bind my data from a SQL database to a datagrid -
works great... I've now created a button and in the OnClick method I do a
"DELETE FROM tablename WHERE keyfield=" +variablename (deletes several
records based on which checkboxes are checked in the datagrid).
The problem is that when the page posts back, the DELETE happens in the
database, but it obviously happens after the SELECT statement that populates
the datagrid. I check the DB contents and the records were indeed deleted,
but the datagrid is always one postback behind (If I post the page back
AGAIN, it will get the update)
What code can I add to make sure the datagrid gets bound AFTER the delete
command happens?
Thanks in advance!
Craig