1

Is something similiar to the following pseduocode possible on server side controls?

<asp:Label runat="server" ID="lbl" Text=<%=DateTime.Now.ToString(); %> />

I.e. assigning attributes.

1

2 Answers 2

1

This will work for databound controls, e.g.

<asp:Label runat="server" ID="lbl" Text="<%# DateTime.Now.ToString() %>" />

Then in your code behind, you'll need to call lbl.DataBind().

Sign up to request clarification or add additional context in comments.

Comments

1

Try this:

<asp:Label runat="server" ID="lbl" Text='<%=DateTime.Now.ToString()%>' /> 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.