Alrighty to make this quick:
set a and set b have flags StartDate="<%# hfStart.value%>" EndDate="<%# hfEnd.value%>"
set a in the item template of a grid view column works like a charm
set b in the HTML table doesn't appear to work at all
What gives?
So far I have tried other server tags with the same code inside but I am obviously missing the salient detail. Why does one work and not the other?
UPDATE: Tried
CDate(hfstart.value).ToString
with <%: and <%= tags <%= hfstart.value %>
Unless I misunderstand, <%= will fire at the very END of the asp.net life cycle stopping it from being useful in this context.
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.