【发布时间】:2010-11-23 21:33:35
【问题描述】:
我有一个代码,但不能让它工作。 我有一个带有命名空间和一个类和一个子的 .vb 站点。 然后在我的 index.aspx 网站上我不能调用这个子 这2个站点在我的项目的根目录下,项目的名称是CalendarWeek
我的 WeekController.vb 是
Imports System
Imports System.Web.UI.WebControls.Calendar
Imports System.Globalization
Namespace CalendarWeekController
Public Class WeekShow
Shared Sub Main()
' Gets the Calendar instance associated with a CultureInfo.
Dim myCI As New CultureInfo("da-DK")
Dim myCal As Calendar = myCI.Calendar
' Gets the DTFI properties required by GetWeekOfYear.
Dim myCWR As CalendarWeekRule = myCI.DateTimeFormat.CalendarWeekRule
Dim myFirstDOW As DayOfWeek = myCI.DateTimeFormat.FirstDayOfWeek
' Displays the number of the current week relative to the beginning of the year.
Console.WriteLine("The CalendarWeekRule used for the en-US culture is {0}.", myCWR)
Console.WriteLine("The FirstDayOfWeek used for the en-US culture is {0}.", myFirstDOW)
Console.WriteLine("Therefore, the current week is Week {0} of the current year.", myCal.GetWeekOfYear(DateTime.Now, myCWR, myFirstDOW))
' Displays the total number of weeks in the current year.
Dim LastDay = New System.DateTime(DateTime.Now.Year, 12, 31)
Console.WriteLine("There are {0} weeks in the current year ({1}).", myCal.GetWeekOfYear(LastDay, myCWR, myFirstDOW), LastDay.Year)
End Sub 'Main
End Class
结束命名空间
我的 index.aspx 是
<%@ Import Namespace="CalendarWeekController" %>
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="index.aspx.vb" Inherits="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.IsPostBack = False Then
Call WeekShow(Sub Main)
End If
End Sub
%>
</div>
</form>
</body>
</html>
我在运行网站时收到此错误。 说明:解析服务此请求所需的资源时出错。请查看以下特定的解析错误详细信息并适当地修改您的源文件。
解析器错误消息:无法加载类型“CalendarWeek.CalendarWeekController”。
来源错误:
第 1 行: 第 2 行: 第 3 行: 第 4 行:
【问题讨论】: