What’s the Difference Between <%# i %> and <%= i %>?

We can use two constructs to access page-level variables in an ASP.NET web template:
data binding syntax
Data binding—the hierarchical mapping of control properties to data container values—is specified by the <%# … %> tags. Code located within a
<%# … %>code block is only executed when the DataBind method of its parent controlcontainer is invoked.

code rendering syntax
The <%= … %> code tags output content to the browser. This content could
be hard-coded, or it may contain page-level variables.

No comments:

Popular Posts