Idea: Select date, year, month, and day
1. You can set the start and end years of a year.
2. Exclude the possibility of incorrect date selection
3. Control using javascript
4. Use the Text attribute to conveniently obtain the set date value
======================================
The code is as follows:
Using System;
Using System. Collections;
Using System. Collections. Specialized;
Using System. ComponentModel;
Using System. IO;
Using System. Text;
Using System. Web. UI;
Using System. Web. UI. Design. WebControls;
Using System. Web. UI. WebControls;
Namespace JSY
{
/// <Summary>
/// AspNetDate select the input date control
/// </Summary>
[DefaultProperty ("Text "),
ParseChildren (false ),
PersistChildren (false ),
Description ("Date control dedicated to ASP. Net Web applications "),
Designer (typeof (DateDesigner )),
ToolboxData ("<{0}: JSYNetDate runat = server> </{0}: JSYNetDate>")]
Public class JSYNetDate: Panel, INamingContainer, IPostBackDataHandler
{
# Region attributes
/// <Summary>
/// Obtain/set the date value.
/// </Summary>
[Bindable (true ),
Browsable (true ),
Description ("Date Value "),
Category ("appearance "),
DefaultValue ("")]
Public string Text
{
Get
{
If (ViewState ["Text"]! = Null)
{
Return ViewState ["Text"]. ToString ();
}
Else
{
If (IsNull)
{
Return "";
}
Else
{
DateTime date = System. DateTime. Today;
String str = "";
Switch (DateFormat)
{
Case "YMD ":
Str = date. ToString ("yyyy-MM-dd", System. Globalization. DateTimeFormatInfo. InvariantInfo );
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.