RegisterScriptBlock ??

  • Thread starter Thread starter Varangian
  • Start date Start date
V

Varangian

Hi all,

whats the use for this function RegisterScriptBlock ?

I'm messing around with the ASP.NET 2.0 Callback and in some examples
on the Net I found that the javascript is being added in the Code
behind on the Page_Load event!

Why is this ? Anyone knows?
Thanks very much appreciated
 
whats the use for this function RegisterScriptBlock ?

I'm messing around with the ASP.NET 2.0 Callback and in some examples
on the Net I found that the javascript is being added in the Code
behind on the Page_Load event!

Why is this ? Anyone knows?

Loads of reasons. One of the main ones is to allow the server-side code to
provide client-side feedback. E.g. a page may need to be validated
server-side (because maybe the value entered in a textbox has to be looked
up in a database etc). RegisterScriptBlock provides an excellent means of
sending a piece of JavaScript (such as an alert etc) back down to the client
to inform the user that the validation has passed / failed.
 
Back
Top