我现在已经做了很长一段时间了。我的代码将显示我尝试解决问题的所有不同方式和事情,但到目前为止没有运气。我需要做的是:
我希望有人可以帮助我理清我做错了什么,并帮助我找到正确的解决方案。到目前为止对结果并不满意。
我的代码隐藏:
Partial Class Request
Inherits Page
Dim ImageButton1 As ImageButton1
Protected Sub Calendar_SelectionChanged(object sender, EventArgs e)
Label.Text = "Current date: " + System.DateTime.Now.ToLongDateString()
Label.Text = "Selected date: " + Calendar.SelectedDate.ToLongDateString()
Dim label1 = System.DateTime.Now
Dim label2 = SelectedDate
Dim ImageButton1 = ImageButton1
End Sub
protected void Calendar_SelectionChanged(object sender, EventArgs e)
{
lblday.Text = Calendar1.TodaysDate.ToShortDateString();
lblbday.Text = Calendar1.SelectedDate.ToShortDateString();
}
' Display using current (en-us) culture's short date format
Dim ddlDate As Date = #3/15/2008#
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Calendar.SelectedDate = DateTime.Now;
Label.Text = "Today's date and time is :" + Calendar.SelectedDate;
Calendar.SelectedDate = DateTime.Today
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Me.clnArrival = thisDate.ToString
End If
End Sub
Sub Submit(s As Object, e As EventArgs)
TextBox1.Text = "The date and time is " & Now()
End Sub
Protected Sub ddlDay_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlDay.SelectedIndexChanged
clnArrival.Visible = False
Dim day As String = ddlDay.SelectedItem.Text(ddlDay.SelectedValue)
End Sub
Protected Sub ddlMonth_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlMonth.SelectedIndexChanged
Dim month As String = ddlMonth.SelectedItem.Text(ddlMonth.SelectedValue)
End Sub
Protected Sub clnArrival_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs) Handles clnArrival.SelectionChanged
ddlMonth_SelectedValue = clnArrival.SelectedDate.Month.ToString
ddlDay_SelectedValue = clnArrival.SelectedDate.Day.ToString
clnArrival.Visible = True
End Sub
End Class
我的标记:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Request.aspx.vb" Inherits="Request" %>
<!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>Chapter 6: Reservations</title>
<link href="Styles/Main.css" rel="stylesheet" type="text/css" />
<link href="Styles/Request.css" rel="stylesheet" type="text/css" />
<script language="VB" runat="server">
Sub Page_Load()
Response.Write("Today is: ")
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="page">
<h1>Royal Inn and Suites</h1>
<h2>Where you’re always treated like royalty</h2>
<p id="arrival_date">
Arrival date:
<asp:Calendar ID = "Calendar" runat = "server" SelectionMode="DayWeekMonth" OnSelectionChanged="Calendar_SelectionChanged" SelectedDate="1/1/0001" VisibleDate="1/1/0001">
<asp:ImageButton ID="ImageButton1" runat="server" AlternateText="Click to show calendar" ImageUrl="C:\aspnet4_vb\Jeanne Tatro Webs 424 - HW 6 - Ch06Reservation\Images\Calendar.bmp" />
</asp:Calendar>
</p>
<p class="clear">
Number of nights:
</p>
<p>
Number of adults:
Children:
</p>
<h3>Preferences</h3>
<p>
Room type:
</p>
<p>
Bed type:
</p>
<p id="requests">Special requests:</p>
<h3 class="clear">Contact information</h3>
<p class="contact">Name:</p>
<p class="contact">Email:</p>
<p id="buttons"></p>
<p id="message"></p>
</div>
</form>
</body>
</html>