自訂日期控制項 (ASP.net)

來源:互聯網
上載者:User
asp.net|控制項 控制項代碼如下:


<script?runat="server">...

????private?void?Calendar1_SelectionChanged(?System.Object?sender,?System.EventArgs??e??)
????...{
????????TextBox1.Text?=?Calendar2.SelectedDate.ToShortDateString();
????????Panel1.Visible?=?false;
????
????}
????private?void?OnClick(?System.Object?sender,?System.EventArgs??e??)
????...{
?????????if?(?Panel1.Visible?)
?????????...{
????????????Panel1.Visible?=?false;
?????????}
?????????else
?????????...{
?????????????Panel1.Visible?=?true;
?????????}
????
????}

script>

<asp:TextBox?id="TextBox1"?runat="server">asp:TextBox>
<asp:Button?id="Button1"?onclick="OnClick"?runat="server"?size="43"?Text="..."?height="22"?width="35"?type="button">asp:Button>

<div?id="divCalendar">
????<asp:Panel?id="Panel1"?runat="server"?Width="172px"?Height="182px"?Visible="False">
????????<asp:Calendar?id="Calendar2"?runat="server"?Width="200px"?Height="180px"?OnSelectionChanged="Calendar1_SelectionChanged"?BorderWidth="2px"?BackColor="White"?ForeColor="Black"?Font-Size="8pt"?Font-Names="Verdana"?BorderColor="#999999"?BorderStyle="Outset"?DayNameFormat="FirstLetter"?CellPadding="4">
????????????<TodayDayStyle?forecolor="Black"?backcolor="#CCCCCC">TodayDayStyle>
????????????<SelectorStyle?backcolor="#CCCCCC">SelectorStyle>
????????????<NextPrevStyle?verticalalign="Bottom">NextPrevStyle>
????????????<DayHeaderStyle?font-size="7pt"?font-bold="True"?backcolor="#CCCCCC">DayHeaderStyle>
????????????<SelectedDayStyle?font-bold="True"?forecolor="White"?backcolor="#666666">SelectedDayStyle>
????????????<TitleStyle?font-bold="True"?bordercolor="Black"?backcolor="#999999">TitleStyle>
????????????<WeekendDayStyle?backcolor="#FFFFCC">WeekendDayStyle>
????????????<OtherMonthDayStyle?forecolor="#808080">OtherMonthDayStyle>
????????asp:Calendar>
????asp:Panel>
div>



調用頁面代碼:





<script?runat="server">...

????//?Insert?page?code?here
????//

script>
<html>
<head>
????<title>Testing?the?Calendartitle>
head>
<body>
????<form?runat="server">
????????<expo:CusCalender?id="cusCalender"?runat="server">expo:CusCalender>
????form>
body>
html>



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.