G
gnewsgroup
I have a gridview, in which people can click on a delete button to try
to delete something from the database.
But, if that selected row cannot be deleted (because, for example, it
is referred to by some other table in the database), I show an alert
like
"An order is associated with this customer, and therefore it cannot be
deleted."
I did this in code-behind through
ScriptManager.RegisterClientScriptBlock(
this.Page,
this.GetType(), "customer_is_not_deleted",
"alert(\"An order is associated with this customer, and
therefore it cannot be deleted.\");",
true);
It works, but only once. Upon the second, 3rd, ..., click, the alert
does not pop up. It work once again if the page is reloaded.
I am using AJAX, I guess it has to do with AJAX. But any workaround if
I want to keep the AJAX?
to delete something from the database.
But, if that selected row cannot be deleted (because, for example, it
is referred to by some other table in the database), I show an alert
like
"An order is associated with this customer, and therefore it cannot be
deleted."
I did this in code-behind through
ScriptManager.RegisterClientScriptBlock(
this.Page,
this.GetType(), "customer_is_not_deleted",
"alert(\"An order is associated with this customer, and
therefore it cannot be deleted.\");",
true);
It works, but only once. Upon the second, 3rd, ..., click, the alert
does not pop up. It work once again if the page is reloaded.
I am using AJAX, I guess it has to do with AJAX. But any workaround if
I want to keep the AJAX?