Server tags not working inside asp controls

孤者浪人 提交于 2019-12-06 14:17:49

As it turns out you DO need to use <%# %> within asp tags as others like <% %> and <%= %> execute at the end of the ASP.NET life cycle and get spit out the buffer to god knows where. When using <%# %> however, the asp control needs to be DataBound(); at the appropriate time.

This happens automatically for controls modeled in the <item template> tags in the gridview because everything within the gridview is bound on its gridview.DataBound() command.

Could it be because you're using the <%# %> tags which are for data binding? This would explain why they work in the GridView, because it supports data binding.

However in a basic HTML table you should use <% %> tags instead, or <%= %> to call a method.

For full details of the tag types, try this reference.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!