Ask a Question related to ASP.NET General, Design and Development.
-
Wes Weems #1
RegisterClientScriptBlock to register OUTSIDE form tags
Hello,
I currently have javascript and vbscript that needs to be spat out based on
certain conditions in the codebehind. My vbscript code relies on the OnLoad
event. However with the RegisterClientScriptBlock(), sticking the code in
the form tags, I cant seem to get the bastard to work.
Basically heres what I *NEED* to do. Generate some js and vbscript to be
output before or after the form tags.
I tried defining the variables in the codebehind with the protected
modifier... then setting them in Page_Load... and then doing <%=myVar%> and
nothing gets spat out to the browser.
If anyone could *PLEASE* give me any words of wisdom, they would be greatly
appreciated.
Wes
Wes Weems Guest
-
Please help, I am not able to register C++ CFX Tags
I was expecting to see a button on the Extensions > CFX Tags page inside CF Administrator but I don't see it there or anyplace else. Let me tell... -
#25676 [Opn->Bgs]: Form hidden input ouput when any form=* is in url_rewriter.tags
ID: 25676 Updated by: sniper@php.net Reported By: davey@php.net -Status: Open +Status: Bogus Bug... -
#25676 [Opn]: Form hidden input ouput when any form=* is in url_rewriter.tags
ID: 25676 Updated by: davey@php.net Reported By: davey@php.net Status: Open Bug Type: Session related... -
#25676 [Bgs->Opn]: Form hidden input ouput when any form=* is in url_rewriter.tags
ID: 25676 Updated by: davey@php.net Reported By: davey@php.net -Status: Bogus +Status: Open Bug... -
#25676 [NEW]: Form hidden input ouput when any form=* is in url_rewriter.tags
From: davey@php.net Operating system: WinXP/FreeBSD PHP version: 4CVS-2003-09-26 (stable) PHP Bug Type: Session related Bug... -
Ken Cox [Microsoft MVP] #2
Re: RegisterClientScriptBlock to register OUTSIDE form tags
Hi Wes, you might find that RegisterStartupScript does what you need since it
runs on load or thereabouts.
In your code behind:
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim strName As String = "Wes"
RegisterStartupScript("start", _
"<script>sayHello('Hello " & strName & "');</script>")
End Sub
' In your .aspx page:
<script language="javascript">
function sayHello(strMsg) {
alert(strMsg);
}
</script>
Ken
MVP [ASP.NET]
"Wes Weems" <wweems3.SPAM@charter.net> wrote in message
news:vhj048q3b7gm64@corp.supernews.com...
Hello,
I currently have javascript and vbscript that needs to be spat out based on
certain conditions in the codebehind. My vbscript code relies on the OnLoad
event. However with the RegisterClientScriptBlock(), sticking the code in
the form tags, I cant seem to get the bastard to work.
Basically heres what I *NEED* to do. Generate some js and vbscript to be
output before or after the form tags.
I tried defining the variables in the codebehind with the protected
modifier... then setting them in Page_Load... and then doing <%=myVar%> and
nothing gets spat out to the browser.
If anyone could *PLEASE* give me any words of wisdom, they would be greatly
appreciated.
Wes
Ken Cox [Microsoft MVP] Guest



Reply With Quote

