views:

19

answers:

2

Hello, I have use embedded code to assign the value to label's text property.But the assign value is not rendering.Here is my code sample,

<%lblProposedYear.Text="Hello"%>

I can not display the text "hello" at the time of page load.

Please help

A: 

If <%lblProposedYear.Text="Hello"%>is your exact code, you might need to add a ; after the statement. That will make it <%lblProposedYear.Text="Hello";%>.

Emil Badh
A: 

Why are you performing this action in the .aspx part why not do this in the .cs backing file at the OnPageLoad point of the code?

Be aware of when during the page life cycle you perform any action on a control. Once you have looked at this explanation of when things happen you may realize that you are doing something before the viewstate is applied:

http://msdn.microsoft.com/en-us/library/ms178472.aspx

Hope this helps.

Richard