This is a migrated thread and some comments may be shown as answers.

radtextbox format date

2 Answers 452 Views
Input
This is a migrated thread and some comments may be shown as answers.
Judith
Top achievements
Rank 1
Judith asked on 10 May 2010, 05:06 PM
I would like to format a date in radtextbox to exclude the time.. I have the following code

<

 

telerik:RadTextBox ID="txtEntryDate"

 

 

EmptyMessage="" ToolTip="Entry date"

 

 

Text='<%#Bind("EntryDate") %>'

 

 

DataFormatString="{0:MM/dd/yyyy}"

 

 

readonly = "true"

 

 

runat="server" Width="100px"/>

This does not work and it is still displayed with the time. I do not want to use a date picker because this date should never be changed.
 Thank you.
Judith

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 May 2010, 06:19 AM

Hi Judith,

Try the following approach in order to format the Date displayed in RadTextBox.

ASPX:

 
<telerik:RadTextBox ID="txtEntryDate" EmptyMessage="" ToolTip="Entry date" Text='<%# String.Format("{0:MM/dd/yyyy}",Eval("EntryDate"))   %>'  
    ReadOnly="true" runat="server" Width="100px" /> 

Also you can use the RadDateInput control as an alternative.

ASPX:

 
<telerik:RadDateInput ID="RadDateInput1" ReadOnly="true" SelectedDate='<%#Eval("EntryDate") %>' DateFormat="MM/dd/yyyy"  
    runat="server">  
</telerik:RadDateInput> 

-Shinu.

0
Eon
Top achievements
Rank 1
answered on 08 Dec 2015, 02:37 PM
Thanks Shinu's, this have help me with the radtextbox, your first solution worked.
Tags
Input
Asked by
Judith
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Eon
Top achievements
Rank 1
Share this question
or