Custom date control (Asp.net)

Source: Internet
Author: User

I know little about ASP. NET. I used web matrix as a date Selection control to make everyone laugh.

The control code is as follows:



<%... @ Control classname = "customcalender" autoeventwireup = "false" Language = "C #" targetschema = "http://schemas.microsoft.com/intellisense/ie5" %>
<SCRIPT runat = "server">...

Private void calendar1_selectionchanged (system. Object sender, system. eventargs E)
...{
Textbox1.text = calendar2.selecteddate. tow.datestring ();
Panel1.visible = false;

}
Private void onclick (system. Object sender, system. eventargs E)
...{
If (panel1.visible)
...{
Panel1.visible = false;
}
Else
...{
Panel1.visible = true;
}

}

</SCRIPT>
<! -- Insert content here -->
<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 = "calendar#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>

Call Page code:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.