Unable to write to asp.net textbox control with the html5 “date” type

后端 未结 2 748
灰色年华
灰色年华 2021-01-04 23:59

I have an asp.net page with a an html5 TextBox control set as the \"date\" type. The control on my page looks like this:



        
相关标签:
2条回答
  • 2021-01-05 00:23

    This is actually the correct way to set the date but the format was wrong!

    TextBoxMyDate.Text = DateTime.UtcNow.ToString("yyyy-MM-dd");
    

    I was confusing how the browser displays the date and the html5 standards for this control!

    0 讨论(0)
  • 2021-01-05 00:35

    Yes, it is quite possible. Here is an example of a date selection filter with ajaxcontrotoolkit and the textbox field.

    Overview:calendar ajaxControlToolkit Overview

    Tutorial:Tutorial ajaxControlTollkit Date textbox

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">  
    </asp:ToolkitScriptManager>  
    
    <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>  
    
    <asp:CalendarExtender   
        ID="CalendarExtender1"   
        TargetControlID="txtStartDate"   
        runat="server" /> 
    
    0 讨论(0)
提交回复
热议问题