Click here to Skip to main content
12,349,148 members (68,561 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: .NET

Hi..

I am getting the error in following line:

<asp:CheckBox ID="chkAnmelder" Checked="false" 
    OnCheckedChanged="javascript:AlterChildren();" runat="server" />
The error is following:
) expected.

Why is this so.. please help me as soon as possible

Posted 25-Nov-09 1:40am
Edited 25-Nov-09 5:05am
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

MS IntelliSense might not show it, but since your checking on every click, try the "OnClick=AlterChildren()" instead of OnCheckChanged. I tested this solution with a simple "alert" command inside of a test function, and it worked fine.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

If your checkbox does nothing but call a client-side function, why are you trying to do it with a server-side event?

use something like 

<INPUT TYPE="checkbox" ID="chkAnmelder" VALUE="1" CHECKED="false"  onClick="AlterChildren()">  

Same functionality, less overhead 

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Its client's desire to convert all the html controls into asp controls..
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Nevertheless, your issue is that OnCheckedChanged is a server side event, and it requires a server side function.  You need to put the event for a html control in there, if you want to call on the client side.  OR if there's an OnClientCheckedChanged, call that and make sure it returns false so no server side event is called.

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 6

Thumbs Up | :thumbsup: Blush | :O Big Grin | :-D Wink | ;) Shucks | :-\ Mad | :mad: OMG | :OMG: Shucks | :-\ Poke tongue | ;-P Unsure | :~ D'Oh! | :doh: Frown | :( D'Oh! | :doh: Laugh | :laugh: Suspicious | :suss: Blush | :O Smile | :) Unsure | :~ OMG | :OMG: Poke tongue | ;-P Laugh | :laugh: Cool | :cool: Unsure | :~ Mad | :mad: Poke tongue | ;-P
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

Hi dharam,

Use (ClientScript.RegisterClientScriptBlock).It is useful for calling client side code.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 22 Feb 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100