Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Button-click's client-side alert shows only once per page load, why?

Reply
Thread Tools

Button-click's client-side alert shows only once per page load, why?

 
 
gnewsgroup
Guest
Posts: n/a
 
      12-20-2007
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?
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      12-20-2007
if its an ajax postback, for the client script to be sent to the client and
eval'd, the control specified in RegisterClientScriptBlock must be one of the
active update panels or one of its children.

-- bruce (sqlwork.com)


"gnewsgroup" wrote:

> 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?
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capture IP only once per visit Mort Strom ASP .Net 1 03-30-2009 04:03 PM
display an alert only once AAaron123 ASP .Net 9 08-11-2008 01:32 PM
SMTPClinet - mailMessage.DeliveryNotificationOptions only works once per session? Scott Townsend ASP .Net 2 10-18-2006 02:01 PM
Resolved -- Re: Simple page displays once then shows only source!? Mark Adams HTML 0 11-13-2005 06:43 PM
Page disappears when alert shows? Robert Zurer ASP .Net 4 05-02-2004 04:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57