开发者

ASP.NET [Date Input]

How to make some Date input control l开发者_JAVA技巧ike a texbox.

I need start date and end date and count period and make a database select. But if I put 2 Calendars on my page that will be looking like wierd :-/ So I want to know how to make some dateinput masks for textboxes or some else solution.


The AjaxControlToolkit offers a couple of ways to do this. Probably the one you want is the CalendarExtender which you attach to a TextBox control, and which displays a clickable calendar when the textbox gets the focus, e.g. this markup:

<asp:ScriptManager runat="server" ID="ScriptManager" />
<asp:TextBox runat="server" ID="TextBox1"></asp:TextBox>
<ajaxtoolkit:CalendarExtender runat="server" ID="MyCalendar" TargetControlID="TextBox1" />

produces this in the browser when the textbox is clicked on:
alt text http://www.philippursglove.com/stackoverflow/calendarextender.png

There's also a DatePicker in JQuery UI that does something similar.

Another extender to look at is the MaskedEditExtender which allows you to limit your user's input so that they can only enter valid dates in a TextBox.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜