473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Registerd Client Script Not Working

Red
I am trying to call some java script from an ASP:Checkbox control.

My code is as follows:
Dim PilotCheckScript As String = "<script language=javascript >" & vbCrLf &
_

"function PilotCheckChanged(){" & vbCrLf & "alert(""Check Changed!"");" &
vbCrLf & _

"txtPILOT.Enabled = !chkPILOT.Checked;" & vbCrLf & "}" _

& vbCrLf & "</script>"

Me.Page.RegisterClientScriptBlock("PilotCheckChang edScript",
PilotCheckScript)

Me.chkPilot.Attributes("OnCheckChanged") = "javascript:PilotCheckChanged();"

The code compiles fine and the web form comes up but nothing happens when
the OnCheckChanged event is fired.

Any help is greatly appreciated.

TIA.
Nov 18 '05 #1
1 1580
Red
I actually modified the code I realized I was should hae been using
OnCheckedChanged not OnCheckChanged, however it still does not work.

It Generates the following HTML:
<script language="javascript">
<!--
function PilotCheckChanged()
{
alert("Check Changed!");
txtPILOT.Enabled = !chkPilot.Checked;
}
//-->
</script>

However it when I attached the scipt to the chkPilot using the Attributes it
generates a <Span OnCheckedChanged="PilotCheckChanged();"> tag .

Should this have added this code to the actual <ASP:Checkbox> tag?
Or will this being wrapped in a <Span> tag suffice?
"Red" <wr****@optonline.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I am trying to call some java script from an ASP:Checkbox control.

My code is as follows:
Dim PilotCheckScript As String = "<script language=javascript >" & vbCrLf & _

"function PilotCheckChanged(){" & vbCrLf & "alert(""Check Changed!"");" &
vbCrLf & _

"txtPILOT.Enabled = !chkPILOT.Checked;" & vbCrLf & "}" _

& vbCrLf & "</script>"

Me.Page.RegisterClientScriptBlock("PilotCheckChang edScript",
PilotCheckScript)

Me.chkPilot.Attributes("OnCheckedChanged") = "PilotCheckChanged();"

The code compiles fine and the web form comes up but nothing happens when
the OnCheckChanged event is fired.

Any help is greatly appreciated.

TIA.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: viktor9990 | last post by:
I have a page called CustomerSlides.aspx which contains an iframe(with the source Lookupage.aspx). The iframe page will look continuously in the database to see if a value has changed: if it is...
1
by: viktor9990 | last post by:
I have a page called CustomerSlides.aspx which contains an iframe(with the source Lookupage.aspx). The iframe page will look continuously in the database to see if a value has changed: if it is...
26
by: Don | last post by:
I'm writing an html page with some JavaScript that reads a web page into a client-side temp file, then reformats it, then submits that same file as a URL to the browser for display, via...
5
by: vanisathish | last post by:
Hi I have an application, which has to change to different images based on some conditions. I am trying to call a javascript function(this function changes the images on the front end) from the...
0
by: viktor9990 | last post by:
I have a page called CustomerSlides.aspx which contains an iframe(with the source Lookupage.aspx). The iframe page will look continuously in the database to see if a value has changed: if it is...
5
by: Alex Maghen | last post by:
I frequently find myself wanting to insert some basic client-side JavaScript functions in the page of an ASPX of mine. But I find it so frustrating that I have to actually contruct my JavaScript in...
5
by: Bjorn Sagbakken | last post by:
Hello I have just migrated from VS 2003 to VS 2005, and .NET framework 1.1 to 2.0 I am at the end of debugging and fixing stuff. Now there is one error I just cannot find a solution to: On...
5
by: Simon | last post by:
I heard that we could do that by using AJAX. Could anybody share how to do it? Thanks.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.