Re: Triggering a javascript after postback from dropdownlist

Tech-Archive recommends: Fix windows errors by optimizing your registry



I think what you really want is Page.RegisterStartupScript. This sets some javascript (or a function you've declared via Page.RegisterScriptBlock) to be called when the window/document loads.

-Brock
DevelopMentor
http://staff.develop.com/ballen



In my form my users are entering some data, one of them being a
dropdownlist. When an item is choosen from that dropdownlist I am
posting back to the server in order to retrieve some data from the
server that are part of the calculation on the client side.

I am using that javascript code also from other control of my form but
WITHOUT postback, in those cases it works fine like this
Me.myControlName.Attributes.Add("onchange", "ComputeValue();") The
same for the dropdownlist doesn't work well as the postback is doing
its job.

On another forum they say I could use a method called
RegisterClientScriptBlock;  I searched the web for that topic and
found a lot of information about this but there is still one thing I
am missing: how I am going to say to run this script after coming back
from the postback. Most example are showing this method linked with a
button or other event manually triggered by a user but I think in my
case it is a touch different.

Jean-Luc
www.corobori.com



.


Quantcast