[Webinar] Streamline your web hosting managementRegister Today


Compiler Error Message: CS1001: Identifier expected ASP.net C#

Posted on 2008-11-19
Medium Priority
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 ASP.net C#

Any idea?

Question by:Faye_DBA
1 Comment
LVL 96

Accepted Solution

Bob Learned earned 2000 total points
ID: 23006234
You can't reference DDYearRange directly in JavaScript, you need to use the 'Yearlst' reference that you got in the line before.

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Suggested Courses

591 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