0

I have a thread that runs querying a DB and returning some values. If this values satisfyes a condition, I want to raise a message box (javascript alert) for the client side.

In my system, users can post some tasks in DB, and the thread is going to constantly query the database to check if user has things to do. If user has, the system must alert him through a message box. The text is very simple, and statik, like "Hey, dude, go work, lazy!" (I'm joking, the message shall be like "You have new task(s). Please check.") Just it!

I've done javascripts invokings with ClientScript.RegisterStartupScript, and Attributes.Add for buttons. But now I want to call the javascript functions (wich will alert the user that he has things to do) from the midle of a sub (that is executed in a thread), without a submit, load or click event. How can I do it?

Thanks!

Alex
  • 3,325
  • 11
  • 52
  • 80

1 Answers1

2

You can't call a client side script directly from the server side code.

The best you can do is use AJAX and poll the server to see when an operation completes and at that point call your javascript function.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • Can I invoke a script programmaticaly without Ajax? http://stackoverflow.com/questions/5017494/ajax-control-toolkit-fsharp-core-error – Alex Feb 23 '11 at 21:09
  • @darth_alexious - No, not from the server side. – Oded Feb 24 '11 at 09:35