Home > Software engineering >  How to change the type of the data in text box?
How to change the type of the data in text box?

Time:11-18

I want my text box to have a date in it, how do I do it?

<asp:TextBox ID="BirthdayRegBt" runat="server"  placeholder="Birthday Date" required=""></asp:TextBox>

CodePudding user response:

You can set the placeholder attribute to indicate a sample value for the field. For Date, there are HTML 5 input types such as date, datetime, datetime-local are available.

for. e.g.

<asp:TextBox ID="TextBox1" runat="server" TextMode="DateTimeLocal" placeholder="12-12-2016" ></asp:TextBox>

html example:

CodePudding user response:

Try this, it will work.

<asp:TextBox Text='<%#DataBinder.Eval(Container.DataItem,"Date", "{0:MM/dd/yyyy}")%>' ID="txtDate" runat="server" placeholder="Date" ></asp:TextBox>
  • Related