html - ASP.Net <%# %> and <%= %> rules? -


can explain me rules around can , cannot evaluated/inserted markup using <%# %> , <%= %> tags in asp.net?

when first discovered inject code-behind variables mark-up using <%= thought 'great'. discovered if such tags present can not add controls collection of page (that's whole different question!). <%# tags ok.

is there way can inject code-behind variable or function evaluation page using <%# ? thanks.

the <%# inline tag used data binding, if want use code-behind variable inside it, have bind page or control variable resides in:

page.databind(); 

you can include statement in page_load or page_prerender event.

see this article more information use of inline tags in asp.net, , this article more server-side databinding.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -