|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how do you execute javascript after script is regsistered?hello,
what code would i use to kick off a javascript script after i had registered it? If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript", strScript) End If looking to kick off a script from inside a codebehind, but conditionally not on an onClick event. is there a way to do this? have also played around with IsStartupScriptRegistered/RegisterStartupScript but still not sure of how to call that script from one of my functions in my codebehind any help would be apprecaited! thanks Simon,
Please do not start new threads if you did not got answers in the other one. The sample is there, Cor hello, sorry for the bad thread etiquette. thought that my question
would get passed over since there were replies. thanks for the link, i'm going to check it out now... Show quoteHide quote >Simon, > >Please do not start new threads if you did not got answers in the other one. > >The sample is there, > >Cor > you need to look at how asp.net works:
1) server build page html 2) server sends page html to browser 3) browser parses and loads html your asp.net code runs in step 1 your javascript runs in step 3 with this model, obviously server code can not call client code. there are a couple a ways to control when the browser runs the client script. the script can be tied to the browser onload event, a click event, or inline (processed during page parse). RegisterStartupScript, renders a script block just before the closing form tag, so it a handly plce to inline script. -- bruce (sqlwork.com) Show quoteHide quote "simon" <m*@here.com> wrote in message news:dd1vt1l4h21lseqddd6dgu2qcs7tbk3psb@4ax.com... > hello, > what code would i use to kick off a javascript script after i had > registered it? > > If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then > Page.RegisterClientScriptBlock("jsScript", strScript) > End If > > looking to kick off a script from inside a codebehind, but > conditionally not on an onClick event. > > is there a way to do this? > have also played around with > IsStartupScriptRegistered/RegisterStartupScript > but still not sure of how to call that script from one of my functions > in my codebehind > > any help would be apprecaited! thanks > thanks bruce. i'm getting the clearer picture of client vs server
processing. regarding inline, that is theoretically what i'm trying to do here if a condition arrises in the parsing, call a javascript function; maybe i need to make a little popup window instead of an alert and call that. once they click Ok send them to the page i originally intended. maybe i'm missing the understanding of inline processing. would a vb fucntion call (based on an event) be considered inline processing? Show quoteHide quote >you need to look at how asp.net works: > >1) server build page html >2) server sends page html to browser >3) browser parses and loads html > >your asp.net code runs in step 1 >your javascript runs in step 3 > >with this model, obviously server code can not call client code. there are a >couple a ways to control when the browser runs the client script. the script >can be tied to the browser onload event, a click event, or inline (processed >during page parse). RegisterStartupScript, renders a script block just >before the closing form tag, so it a handly plce to inline script. > >-- bruce (sqlwork.com) > > >"simon" <m*@here.com> wrote in message >news:dd1vt1l4h21lseqddd6dgu2qcs7tbk3psb@4ax.com... >> hello, >> what code would i use to kick off a javascript script after i had >> registered it? >> >> If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then >> Page.RegisterClientScriptBlock("jsScript", strScript) >> End If >> >> looking to kick off a script from inside a codebehind, but >> conditionally not on an onClick event. >> >> is there a way to do this? >> have also played around with >> IsStartupScriptRegistered/RegisterStartupScript >> but still not sure of how to call that script from one of my functions >> in my codebehind >> >> any help would be apprecaited! thanks >> > no.
<html> <body> <script> // inline javascript - executed during page parse by browser document.write("<input type=button onclick='btnClick()'>"); // javascript function executed by user event function btnClick() { alert("clicked button"); } </script> </body> </htm> -- bruce (sqlwork.com) Show quoteHide quote "simon" <m*@here.com> wrote in message news:g8avt15c2foebvfejlelkeav5dmhirdcpo@4ax.com... > thanks bruce. i'm getting the clearer picture of client vs server > processing. > regarding inline, that is theoretically what i'm trying to do here > if a condition arrises in the parsing, call a javascript function; > maybe i need to make a little popup window instead of an alert and > call that. once they click Ok send them to the page i originally > intended. > maybe i'm missing the understanding of inline processing. would a vb > fucntion call (based on an event) be considered inline processing? > >>you need to look at how asp.net works: >> >>1) server build page html >>2) server sends page html to browser >>3) browser parses and loads html >> >>your asp.net code runs in step 1 >>your javascript runs in step 3 >> >>with this model, obviously server code can not call client code. there are >>a >>couple a ways to control when the browser runs the client script. the >>script >>can be tied to the browser onload event, a click event, or inline >>(processed >>during page parse). RegisterStartupScript, renders a script block just >>before the closing form tag, so it a handly plce to inline script. >> >>-- bruce (sqlwork.com) >> >> >>"simon" <m*@here.com> wrote in message >>news:dd1vt1l4h21lseqddd6dgu2qcs7tbk3psb@4ax.com... >>> hello, >>> what code would i use to kick off a javascript script after i had >>> registered it? >>> >>> If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then >>> Page.RegisterClientScriptBlock("jsScript", strScript) >>> End If >>> >>> looking to kick off a script from inside a codebehind, but >>> conditionally not on an onClick event. >>> >>> is there a way to do this? >>> have also played around with >>> IsStartupScriptRegistered/RegisterStartupScript >>> but still not sure of how to call that script from one of my functions >>> in my codebehind >>> >>> any help would be apprecaited! thanks >>> >> > thanks for clarifying
Show quoteHide quote >no. > > ><html> ><body> > <script> > > // inline javascript - executed during page parse by browser > > document.write("<input type=button onclick='btnClick()'>"); > > // javascript function executed by user event > > function btnClick() > { > alert("clicked button"); > } > </script> ></body> ></htm> > > >-- bruce (sqlwork.com) > > > >"simon" <m*@here.com> wrote in message >news:g8avt15c2foebvfejlelkeav5dmhirdcpo@4ax.com... >> thanks bruce. i'm getting the clearer picture of client vs server >> processing. >> regarding inline, that is theoretically what i'm trying to do here >> if a condition arrises in the parsing, call a javascript function; >> maybe i need to make a little popup window instead of an alert and >> call that. once they click Ok send them to the page i originally >> intended. >> maybe i'm missing the understanding of inline processing. would a vb >> fucntion call (based on an event) be considered inline processing? >> >>>you need to look at how asp.net works: >>> >>>1) server build page html >>>2) server sends page html to browser >>>3) browser parses and loads html >>> >>>your asp.net code runs in step 1 >>>your javascript runs in step 3 >>> >>>with this model, obviously server code can not call client code. there are >>>a >>>couple a ways to control when the browser runs the client script. the >>>script >>>can be tied to the browser onload event, a click event, or inline >>>(processed >>>during page parse). RegisterStartupScript, renders a script block just >>>before the closing form tag, so it a handly plce to inline script. >>> >>>-- bruce (sqlwork.com) >>> >>> >>>"simon" <m*@here.com> wrote in message >>>news:dd1vt1l4h21lseqddd6dgu2qcs7tbk3psb@4ax.com... >>>> hello, >>>> what code would i use to kick off a javascript script after i had >>>> registered it? >>>> >>>> If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then >>>> Page.RegisterClientScriptBlock("jsScript", strScript) >>>> End If >>>> >>>> looking to kick off a script from inside a codebehind, but >>>> conditionally not on an onClick event. >>>> >>>> is there a way to do this? >>>> have also played around with >>>> IsStartupScriptRegistered/RegisterStartupScript >>>> but still not sure of how to call that script from one of my functions >>>> in my codebehind >>>> >>>> any help would be apprecaited! thanks >>>> >>> >> >
I finally did it-- hungarian notation
What am i missing to raise a javascript alert currentFocus Outlook.MaiIteml.Move: The RPC server is not available Can't View Form in Designer Visual Basic .NET 2005 Express Global ImageList Unhandled handled exception in Catch line Event order problem Getting an object Using Winsock / TCP Client |
|||||||||||||||||||||||