Hi Siudp,
As for the two expressions you mentioned, they're two different things
which have different usage in asp.net web page.
The <%= %> expression is just dervied from the classic asp, which help to
output content on page(just like the response.Write()). So it is ok to
output a page's protected / public member value via it.
However, the <%# expression... %> is rather different, it's the
databinding expression in asp.net which is used to perform databinding
task. And it is not only used on page but mainly used in many template
databinding controls such as (DataGrid/ DataList)'s template. And the
expressions in the <%# %> will be called when its container control's
"DataBind()" method is called. So if you use the <%# %> on your page, it
will only be called when you call the Page.DataBind() mehtod, then all the
sub control(on the page)'s "DataBind()" will also be called recursively.
For detailed reference on the asp.net databinding expression, you may have
a look at the following msdn doc:
#Data Binding Expression Syntax
http://msdn.microsoft.com/library/en-us/cpgenref/html/cpcondatabindingexpres
sionsyntax.asp?frame=true
Hope helps. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)