How to get current date in ASP.NET and telerik:RadTextBox

6.3k views Asked by At

How can I see the current date in a .aspx file using telerik RadTextBox.

I tried this:

<telerik:RadTextBox ID="RadTextBox1" runat="server" Width="50%" ReadOnly="true" Text='<%# DateTime.Now.ToString("dd-MM-yyyy") %>' />

But I can't see anything.

Any idea? Thanks.

1

There are 1 answers

2
rdmptn On BEST ANSWER

Do that on the server:

private void Page_Load(object sender, System.EventArgs e)
{
    RadTextBox1.Text = DateTime.Now.ToString("dd-MM-yyyy")
}