Hi,
I am coming up with a calendar.I am using ASP.net with C#.I am having using a .ascx file format. i am getting an error on the
10th line. it shows CS1001:identifier expected. i am not sure of what to do. Please guide me of my mistake. im using Visual web developer 2008 express

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MonthSelectControl.ascx.cs" Inherits="MonthSelectControl" %>

<%@ import namespace="system.web" %>
<%@ import namespace="system.web.security" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
	function nextYear(forward) {
		var yearField = document.getElementById("<%= txtYear.ClientID %>");
		var testEr = new RegExp( 'd','g');
		if(testEr.test(yearField.value)) {
			var yearValue = parseInt(yearField.value);
			if(forward)
				yearValue = yearValue+1;
			else
				yearValue = yearValue-1;
			yearField.value = yearValue;
		} else {
		var newDate = new Date();
		yearField.value = newDate.getFullYear();
		}
	}
</script>

<div style="border: 1px solid black; width: 100px; text-align: center;">
<div style="background-color: rgb(255,238,187); padding-top: 2px;">
 <img src="<%= Page.ResolveUrl("~/images/prev1.gif") %>" border="0" onclick="nextYear(false);"/>
 <asp:TextBox ID="txtYear" Runat="server" CssClass="form" Width="50" style="width: 50px; border: 1px solid; text-align: center;" MaxLength="4"
 ></asp:TextBox>
 <img src="<%= Page.ResolveUrl("~/images/next1.gif") %>" border="0" onclick="nextYear(true);">
 <hr style="border: black 1px solid;" size="1"></hr>
 </div>
<table align="center" style="width: 163%">
	<tr>
		<td><asp:LinkButton ID="lnkJan" Runat=server OnClick="lnkMonthClick">Jan</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkFeb" Runat=server OnClick="lnkMonthClick">Feb</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMar" Runat=server OnClick="lnkMonthClick">Mar</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkApr" Runat=server OnClick="lnkMonthClick">Apr</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMay" Runat=server OnClick="lnkMonthClick">May</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkJun" Runat=server OnClick="lnkMonthClick">Jun</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkJul" Runat=server OnClick="lnkMonthClick">Jul</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkAug" Runat=server OnClick="lnkMonthClick">Aug</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkSep" Runat=server OnClick="lnkMonthClick">Sep</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkOct" Runat=server OnClick="lnkMonthClick">Oct</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkNov" Runat=server OnClick="lnkMonthClick">Nov</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkDec" Runat=server OnClick="lnkMonthClick">Dec</asp:LinkButton>
		</td>
	</tr>
</table>
</div>

Which line is doing that? Can you put it in bold or something? I'm not sure if your counting the whitespace as a line number.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MonthSelectControl.ascx.cs" Inherits="MonthSelectControl" %>

<%@ import namespace="system.web" %>
<%@ import namespace="system.web.security" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
	[B]function nextYear(forward) {[/B]		

                    var yearField = document.getElementById("<%= txtYear.ClientID %>");
		var testEr = new RegExp( 'd','g');
		if(testEr.test(yearField.value)) {
			var yearValue = parseInt(yearField.value);
			if(forward)
				yearValue = yearValue+1;
			else
				yearValue = yearValue-1;
			yearField.value = yearValue;
		} else {
		var newDate = new Date();
		yearField.value = newDate.getFullYear();
		}
	}
</script>

<div style="border: 1px solid black; width: 100px; text-align: center;">
<div style="background-color: rgb(255,238,187); padding-top: 2px;">
 <img src="<%= Page.ResolveUrl("~/images/prev1.gif") %>" border="0" onclick="nextYear(false);"/>
 <asp:TextBox ID="txtYear" Runat="server" CssClass="form" Width="50" style="width: 50px; border: 1px solid; text-align: center;" MaxLength="4"
 ></asp:TextBox>
 <img src="<%= Page.ResolveUrl("~/images/next1.gif") %>" border="0" onclick="nextYear(true);">
 <hr style="border: black 1px solid;" size="1"></hr>
 </div>
<table align="center" style="width: 163%">
	<tr>
		<td><asp:LinkButton ID="lnkJan" Runat=server OnClick="lnkMonthClick">Jan</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkFeb" Runat=server OnClick="lnkMonthClick">Feb</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMar" Runat=server OnClick="lnkMonthClick">Mar</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkApr" Runat=server OnClick="lnkMonthClick">Apr</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMay" Runat=server OnClick="lnkMonthClick">May</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkJun" Runat=server OnClick="lnkMonthClick">Jun</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkJul" Runat=server OnClick="lnkMonthClick">Jul</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkAug" Runat=server OnClick="lnkMonthClick">Aug</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkSep" Runat=server OnClick="lnkMonthClick">Sep</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkOct" Runat=server OnClick="lnkMonthClick">Oct</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkNov" Runat=server OnClick="lnkMonthClick">Nov</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkDec" Runat=server OnClick="lnkMonthClick">Dec</asp:LinkButton>
		</td>
	</tr>
</table>
</div><%@ Control Language="C#" AutoEventWireup="true" CodeFile="MonthSelectControl.ascx.cs" Inherits="MonthSelectControl" %>

<%@ import namespace="system.web" %>
<%@ import namespace="system.web.security" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
	function nextYear(forward) {
		var yearField = document.getElementById("<%= txtYear.ClientID %>");
		var testEr = new RegExp( 'd','g');
		if(testEr.test(yearField.value)) {
			var yearValue = parseInt(yearField.value);
			if(forward)
				yearValue = yearValue+1;
			else
				yearValue = yearValue-1;
			yearField.value = yearValue;
		} else {
		var newDate = new Date();
		yearField.value = newDate.getFullYear();
		}
	}
</script>

<div style="border: 1px solid black; width: 100px; text-align: center;">
<div style="background-color: rgb(255,238,187); padding-top: 2px;">
 <img src="<%= Page.ResolveUrl("~/images/prev1.gif") %>" border="0" onclick="nextYear(false);"/>
 <asp:TextBox ID="txtYear" Runat="server" CssClass="form" Width="50" style="width: 50px; border: 1px solid; text-align: center;" MaxLength="4"
 ></asp:TextBox>
 <img src="<%= Page.ResolveUrl("~/images/next1.gif") %>" border="0" onclick="nextYear(true);">
 <hr style="border: black 1px solid;" size="1"></hr>
 </div>
<table align="center" style="width: 163%">
	<tr>
		<td><asp:LinkButton ID="lnkJan" Runat=server OnClick="lnkMonthClick">Jan</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkFeb" Runat=server OnClick="lnkMonthClick">Feb</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMar" Runat=server OnClick="lnkMonthClick">Mar</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkApr" Runat=server OnClick="lnkMonthClick">Apr</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMay" Runat=server OnClick="lnkMonthClick">May</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkJun" Runat=server OnClick="lnkMonthClick">Jun</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkJul" Runat=server OnClick="lnkMonthClick">Jul</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkAug" Runat=server OnClick="lnkMonthClick">Aug</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkSep" Runat=server OnClick="lnkMonthClick">Sep</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkOct" Runat=server OnClick="lnkMonthClick">Oct</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkNov" Runat=server OnClick="lnkMonthClick">Nov</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkDec" Runat=server OnClick="lnkMonthClick">Dec</asp:LinkButton>
		</td>
	</tr>
</table>
</div>
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MonthSelectControl.ascx.cs" Inherits="MonthSelectControl" %>

<%@ import namespace="system.web" %>
<%@ import namespace="system.web.security" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
	[B]function nextYear(forward) [/B]{
	           var yearField = document.getElementById("<%= txtYear.ClientID %>");
		var testEr = new RegExp( 'd','g');
		if(testEr.test(yearField.value)) {
			var yearValue = parseInt(yearField.value);
			if(forward)
				yearValue = yearValue+1;
			else
				yearValue = yearValue-1;
			yearField.value = yearValue;
		} else {
		var newDate = new Date();
		yearField.value = newDate.getFullYear();
		}
	}
</script>

<div style="border: 1px solid black; width: 100px; text-align: center;">
<div style="background-color: rgb(255,238,187); padding-top: 2px;">
 <img src="<%= Page.ResolveUrl("~/images/prev1.gif") %>" border="0" onclick="nextYear(false);"/>
 <asp:TextBox ID="txtYear" Runat="server" CssClass="form" Width="50" style="width: 50px; border: 1px solid; text-align: center;" MaxLength="4"
 ></asp:TextBox>
 <img src="<%= Page.ResolveUrl("~/images/next1.gif") %>" border="0" onclick="nextYear(true);">
 <hr style="border: black 1px solid;" size="1"></hr>
 </div>
<table align="center" style="width: 163%">
	<tr>
		<td><asp:LinkButton ID="lnkJan" Runat=server OnClick="lnkMonthClick">Jan</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkFeb" Runat=server OnClick="lnkMonthClick">Feb</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMar" Runat=server OnClick="lnkMonthClick">Mar</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkApr" Runat=server OnClick="lnkMonthClick">Apr</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMay" Runat=server OnClick="lnkMonthClick">May</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkJun" Runat=server OnClick="lnkMonthClick">Jun</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkJul" Runat=server OnClick="lnkMonthClick">Jul</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkAug" Runat=server OnClick="lnkMonthClick">Aug</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkSep" Runat=server OnClick="lnkMonthClick">Sep</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkOct" Runat=server OnClick="lnkMonthClick">Oct</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkNov" Runat=server OnClick="lnkMonthClick">Nov</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkDec" Runat=server OnClick="lnkMonthClick">Dec</asp:LinkButton>
		</td>
	</tr>
</table>
</div><%@ Control Language="C#" AutoEventWireup="true" CodeFile="MonthSelectControl.ascx.cs" Inherits="MonthSelectControl" %>

<%@ import namespace="system.web" %>
<%@ import namespace="system.web.security" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
	function nextYear(forward) {
		var yearField = document.getElementById("<%= txtYear.ClientID %>");
		var testEr = new RegExp( 'd','g');
		if(testEr.test(yearField.value)) {
			var yearValue = parseInt(yearField.value);
			if(forward)
				yearValue = yearValue+1;
			else
				yearValue = yearValue-1;
			yearField.value = yearValue;
		} else {
		var newDate = new Date();
		yearField.value = newDate.getFullYear();
		}
	}
</script>

<div style="border: 1px solid black; width: 100px; text-align: center;">
<div style="background-color: rgb(255,238,187); padding-top: 2px;">
 <img src="<%= Page.ResolveUrl("~/images/prev1.gif") %>" border="0" onclick="nextYear(false);"/>
 <asp:TextBox ID="txtYear" Runat="server" CssClass="form" Width="50" style="width: 50px; border: 1px solid; text-align: center;" MaxLength="4"
 ></asp:TextBox>
 <img src="<%= Page.ResolveUrl("~/images/next1.gif") %>" border="0" onclick="nextYear(true);">
 <hr style="border: black 1px solid;" size="1"></hr>
 </div>
<table align="center" style="width: 163%">
	<tr>
		<td><asp:LinkButton ID="lnkJan" Runat=server OnClick="lnkMonthClick">Jan</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkFeb" Runat=server OnClick="lnkMonthClick">Feb</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMar" Runat=server OnClick="lnkMonthClick">Mar</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkApr" Runat=server OnClick="lnkMonthClick">Apr</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkMay" Runat=server OnClick="lnkMonthClick">May</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkJun" Runat=server OnClick="lnkMonthClick">Jun</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkJul" Runat=server OnClick="lnkMonthClick">Jul</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkAug" Runat=server OnClick="lnkMonthClick">Aug</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkSep" Runat=server OnClick="lnkMonthClick">Sep</asp:LinkButton>
		</td>
	</tr>
	<tr>
		<td><asp:LinkButton ID="lnkOct" Runat=server OnClick="lnkMonthClick">Oct</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkNov" Runat=server OnClick="lnkMonthClick">Nov</asp:LinkButton>
		</td>
		<td><asp:LinkButton ID="lnkDec" Runat=server OnClick="lnkMonthClick">Dec</asp:LinkButton>
		</td>
	</tr>
</table>
</div>

Get rid of runat="server" in that script tag. That isn't server side script; it's javascript which runs on the client.

After all deleting the script, im getting the error as below


Compiler Error Message: The compiler failed with error code 1.

Show Detailed Compiler Output:


C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE> "C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website5\3283cf51\1ce8f6c6\App_Web_monthselectcontrol.ascx.cdcab7d2.yry9hvyj.dll" /D:DEBUG /debug+ /optimize- /win32res:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website5\3283cf51\1ce8f6c6\q5qi26ce.res" /w:4 /nowarn:1659;1699;1701 /warnaserror- "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website5\3283cf51\1ce8f6c6\App_Web_monthselectcontrol.ascx.cdcab7d2.yry9hvyj.0.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website5\3283cf51\1ce8f6c6\App_Web_monthselectcontrol.ascx.cdcab7d2.yry9hvyj.1.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website5\3283cf51\1ce8f6c6\App_Web_monthselectcontrol.ascx.cdcab7d2.yry9hvyj.2.cs"


Microsoft (R) Visual C# 2008 Compiler version 3.5.21022.8
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

c:\Documents and Settings\user\My Documents\Visual Studio 2008\WebSites\WebSite5\MonthSelectControl.ascx.cs(912305,33): error CS0115: 'ASP.monthselectcontrol_ascx.FrameworkInitialize()': no suitable method found to override

dude <script runat="server">

remove runat="server" ...do the same for head tag....

everything will be okey...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.