Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gnewsgroup - 20 Dec 2007 15:30 GMT
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?
bruce barker - 20 Dec 2007 16:41 GMT
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)

> I have a gridview, in which people can click on a delete button to try
> to delete something from the database.
[quoted text clipped - 20 lines]
> I am using AJAX, I guess it has to do with AJAX. But any workaround if
> I want to keep the AJAX?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.