user2097810
user2097810

Reputation: 741

Using TextBox with Type=datetime , in ASP.net

I have textbox like that (VS 2010):

<asp:TextBox type="date" ID="rSLA" runat="server" ></asp:TextBox>

and it's working fine, but when I change the type to : datetime (cause I need date and hour) , the datepicker not working. why?

Thank you.

Upvotes: 0

Views: 16828

Answers (3)

Chris
Chris

Reputation: 2646

Which browser are you using? I notice on there that for Chrome, datetime is unsupported but datetime-local is, maybe that solves your problem.

Upvotes: 4

mason
mason

Reputation: 32693

If you're trying to use HTML5 datetime input type, it's good to check on what browsers support it first. According to this, it only appears a few mobile browsers are supported. So instead you should use a 3rd party Datepicker. There's a built-in one that doesn't work very well, there's one in the Ajax Control Toolkit that works well, jQuery UI has one (that's my personal pref) or you can Google for one.

Upvotes: 0

Dgan
Dgan

Reputation: 10285

setting type="datetime" for textbox it Doesn't Mean that it will show calender for You. You can Use Calender from Ajax

in front of TextBox

<asp:TextBox ID="rSLA" runat="server" ></asp:TextBox>
<asp:Calendar ID="Calendar1" runat="server" Width="150px" 
                DayNameFormat="Shortest"  Height="25px" /> 
            </asp:Calendar> 

Refer this http://www.codeproject.com/Articles/19991/DatePicker-in-ASP-NET-and-AJAX-Control-Toolkit

Upvotes: 0

Related Questions