3

I should know this by now, but I don't, and for some reason, I am not finding the answer on Google, so I thought I'd try here.

I know that <%= %> is the equivalent of Response.Write()

And I've seen <%# %> for databinding.

However, today I noticed something new, and even though I can see what it's doing, I am looking for the official documentation on this. In one of my web pages, I see

ConnectionString="<%$ ConnectionStrings:SomeConnectionString %>"

So what does <%$ %> do?

David
  • 72,686
  • 18
  • 132
  • 173
  • Thank you to all who answered. Both @Thomas Jaskula and @Joewl Coehoorn's answers were good and helpful, and got voted up, and I had a hard time choosing which to accept. I decided to use @Thomas' answer because if the link I was looking for. Thank you both! – David Feb 04 '10 at 17:28
  • possible duplicate of [<%$, <%@, <%=, <%#...what's the deal?](http://stackoverflow.com/questions/957284/whats-the-deal) – ChrisF Sep 15 '11 at 21:15

3 Answers3

7

See this question:
In ASP.Net, what is the difference between <%= and <%#

In summary ,there are a several different 'bee-stings':

  • <%@ - Page/Control/Import/Register directive
  • <%$ - Resource access and Expression building
  • <%= - Explicit output to page, equivalent to <% Response.Write( ) %>
  • <%# - Data Binding. It can only used where databinding is supported, or at the page level if you call Page.DataBind() in your code-behind.
  • <%-- - Server-side comment block
  • <%: - Equivalent to <%=, but it also HTMLEncode()s the output.
Community
  • 1
  • 1
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
5

Used for expressions, not code; often seen with DataSources

http://msdn.microsoft.com/en-us/library/d5bd1tad.aspx

Tomasz Jaskuλa
  • 15,723
  • 5
  • 46
  • 73
0

It's markup used to evaluate expressions rather than code.

Joel Etherton
  • 37,325
  • 10
  • 89
  • 104
  • I would like to vote this up just because you took the effort and it's technically accurate. However, it's not particularly helpful without further explanation. – David Feb 04 '10 at 17:30
  • Eh, I thought about deleting it. I ended my typing when the "1 new answer" popup came up. I hit the add button and it turns out the guy before me answered already so I didn't bother finishing. – Joel Etherton Feb 04 '10 at 17:36