Solved c# check box with javascript issue

Posted on 2012-09-20
Last Modified: 2012-09-20
I'm trying to implement some javascript with a check box showing or not showing a <DIV>  
I'm getting the following error:
Compiler Error Message: CS1012: Too many characters in character literal

The script:
<script type="text/javascript" language="javascript">
    function showMe(it, box) {
        var vis = (box.checked) ? "block" : "none";
        document.getElementById(it).style.display = vis;

Open in new window

 <asp:CheckBox ID="cbGuest1" Text="Guest 1" OnCheckedChanged="showMe('Guest1', this)" runat="server" /> 

Open in new window

I will end up with 6 check boxes total but am trying to test with just this one.
Thanks for any suggestions.
Question by:javierpdx
    LVL 18

    Accepted Solution

    For javascript use onclick ,
    <asp:CheckBox ID="cbGuest1" Text="Guest 1" onclick="showMe('Guest1', this)" runat="server" /> 

    Open in new window


    Author Comment

    It worked.  Thanks!

    Author Closing Comment

    It worked great.  Thanks!

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now