Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Registerd Client Script Not Working

Reply
Thread Tools

Registerd Client Script Not Working

 
 
Red
Guest
Posts: n/a
 
      04-24-2004
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") = "JavaScriptilotCheckChanged();"



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.


 
Reply With Quote
 
 
 
 
Red
Guest
Posts: n/a
 
      04-24-2004
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" <> wrote in message
news:%...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET client-side validation working, but button click not working Alan Silver ASP .Net 1 08-02-2005 03:50 PM
Mail Problem - Library not Registerd DanB ASP .Net 0 09-23-2004 03:07 PM
Can TagPrefix be registerd in web.config? Bob ASP .Net 1 06-23-2004 09:44 PM
who is this registerd to? Craig Sutton NZ Computing 7 05-17-2004 08:07 PM
Script is working in IE, but not working in Netscape 7 - trouble with document.selection.createRange(); lawrence Javascript 8 05-05-2004 01:43 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57