简体   繁体   中英

Unable to enter a date into a textbox in Asp.net

  <asp:TextBox ID="txtBalochistanExpireDate" runat="server" MaxLength="50" TextMode="Date" CssClass="form-control" ></asp:TextBox>

////CodeBehind
txtBalochistanExpireDate.Text = vehiclerootpermit.BalochistanExpireDate.ToString();

Textbox is showing "mm/dd/yyyy" as text in textfield, it should display "21/10/2014" in the textfield which is the value of vehiclerootpermit.BalochistanExpireDate .

General Information:

BalocistanExpireDate datatype is DateTime in SQL SERVER.

Try it by removing .ToString()

Your code must be like

txtBalochistanExpireDate.Text = vehiclerootpermit.BalochistanExpireDate.Date

Please share the result as in my case (I have tried your code) your code is cresting a problem as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM