user1911
user1911

Reputation: 710

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

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.

Upvotes: 0

Views: 6330

Answers (1)

rdmptn
rdmptn

Reputation: 5603

Do that on the server:

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

Upvotes: 1

Related Questions