开发者

asp.net embedded code with asp.net server control

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 t开发者_开发知识库he time of page load.

Please help


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜