带有日期时间日历的文本框 [英] Textbox with datetime calendar
本文介绍了带有日期时间日历的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好
我如何使用带有日期日历的文本框。我想在文本框旁边添加日期日历,当选择日期时,应该将其带入textbox.text
How can I use textbox with date calendar.I want to bring date calendar besides the textbox and when select the date , should be brought into textbox.text
请帮助。
Pol
polachan
推荐答案
使用 asp:日历
<asp:Calendar ID="Calendar2" runat="server" BorderWidth="2px" BackColor="white" Width="200px"
ForeColor="Black" Height="180px" Font-Size="8pt" Font-Names="Verdana" BorderColor="#E4DA85"
BorderStyle="Outset" DayNameFormat="FirstLetter" CellPadding="4" OnSelectionChanged="Calendar2_SelectionChanged">
<TodayDayStyle ForeColor="Black" BackColor="#E9E19A"></TodayDayStyle>
<DayHeaderStyle Font-Size="7pt" Font-Bold="True" BackColor="#E9E19A"></DayHeaderStyle>
<SelectedDayStyle Font-Bold="True" ForeColor="White" BackColor="#D5D900"></SelectedDayStyle>
</asp:Calendar>
protected void Calendar2_SelectionChanged(System.Object sender, System.EventArgs e)
{
TextBox1.Text = Convert.ToDateTime(Calendar2.SelectedDate, CultureInfo.GetCultureInfo("en-US")).ToString("MM/dd/yyyy");
}
这篇关于带有日期时间日历的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文