我正在使用带有 ASP.NET 的日历控件来填充带有所选日期的文本框。选择日期时,应显示在标签中,但标签不显示所选日期。请帮忙。谢谢你。
这是我将日期放入标签的代码:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<script runat="server">
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Label1.Text = Calendar1.SelectedDate.ToString();
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
MakeAppointment
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<form id="form1" runat="server" style="height: 388px">
<h2>MakeAppointment<asp:Calendar ID="Calendar1" runat="server"
onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar>
</h2>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</asp:Content>