<%# and <%=

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

what the difference between <%# and <%= in asp.net?

Thanks all,

Jon
 
The <%= %> construct will write into the output stream of the page,
think of it as a Response.Write.

The <%# %> construct is the 'data binding' syntax. You can use the
data binding syntax to set the properties of controls on the page,
like setting the ImageUrl property of the Image control. Data binding
only happens if the control or the control's parent has the DataBind
method invoked. It's also used inside the ItemTemplates of a Repeater,
for instance, to spit out the values in the underlying data source.

Is that helpful?
 
Scott,

That's great, thanks very much.

Jon

Scott Allen said:
The <%= %> construct will write into the output stream of the page,
think of it as a Response.Write.

The <%# %> construct is the 'data binding' syntax. You can use the
data binding syntax to set the properties of controls on the page,
like setting the ImageUrl property of the Image control. Data binding
only happens if the control or the control's parent has the DataBind
method invoked. It's also used inside the ItemTemplates of a Repeater,
for instance, to spit out the values in the underlying data source.

Is that helpful?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top