as a shortcut for <% Response.Write("w" /> as a shortcut for <% Response.Write("w" /> as a shortcut for <% Response.Write("w"/>

What does <%# "whatever" %> mean in ASP.NET?

28.2k Views Asked by At

Possible Duplicate:
Meaning of the various symbols in .aspx page of asp.net

I'm familiar with <%= "whatever" %> as a shortcut for <% Response.Write("whatever"); %>.

But I've recently come across some code that uses <%# %> instead. In this particular codebase, it's only being used inside of an <asp:Repeater /> but I

What does <%# %> do and when can/should it be used?

3

There are 3 best solutions below

1
Leniel Maccaferri On BEST ANSWER

<%# ... %>

Data-binding expressions are an important set of code delimiters, which are used to create a binding between a server control property and a data source.

More about it here:

ASP.NET Code Delimiters

0
Ashok Padmanabhan On

Its used in conjunction with Databind.Eval as in <%# DataBinder.Eval(Container.DataItem, "Price") %>

Here is an MSDN page onthe matter

0
MethodMan On

That's how you do "BINDING" you may want to do a google search on asp.net data binding also to if you are using something like system.web.htmlcontrols this is how you could also get at document variables by name when using javascript.