Compiler Error Message: CS1001: Identifier expected C#

Posted on 2008-11-19
Last Modified: 2012-05-05
The following is my Dropdownlist that on SelectedIndexChanged() calls a javascrip function:

<asp:DropDownList id="DDYearRange" runat="server" OnSelectedIndexChanged="SetYearRange()";>
          <asp:ListItem Value="2004-2008">2004 - 2008</asp:ListItem>
          <asp:ListItem Value="2007-2008">2007 - 2008</asp:ListItem>

the following is my javascript function:

      function SetYearRange()
        var Yearlst = document.getElementById("DDYearRange");
        var txtHidden = document.getElementById("ReportHIddenText");
        txtHidden.value = Yearlst.options[DDYearRange.selectedIndex].text;
        return true;
I aslo have the following tag on the form:
<input type="hidden" name="ReportHiddenID" id="ReportHIddenText">

When I try to view in browser, I get the following error message:
Compiler Error Message: CS1001: Identifier expected C#

Any idea?

Question by:Faye_DBA
    1 Comment
    LVL 96

    Accepted Solution

    You can't reference DDYearRange directly in JavaScript, you need to use the 'Yearlst' reference that you got in the line before.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    794 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

    16 Experts available now in Live!

    Get 1:1 Help Now