How does <%$ %> and <%# %> work in ASP.NET?
I was using ASP.NET Web Forms and ASP.NET MVC for some period of time.
So <%= %> in views mean Response.Write(), <%: %> introduced in MVC adds html escaping.
In SqlDataSource control designer generates something like this ConnectionString="<%$ ConnectionStrings:FooConnectionString %>" and in repeater you use <%# Eval("") %> sytax.
My question is what exactly do <%$ %> and <%# %> tags, what methods they traslated into and how do they behave?
<%$ %> is the expression syntax.
There are some built in shortcuts for AppSettings, Resources and ConnectionStrings. You can also write your own.
<%# %> is the databinding expression syntax.
This is used in databound controls to resolve property values from the object being bound.
I clipped this text from a book (I can't remember which book) a while ago as I thought it explained the <%# %> syntax well -
Those of you familiar with classic ASP applications might think that the <%# %> syntax looks very familiar. It is similar in purpose, but you need to make sure that you don't confuse the two because doing so could cause your application to function improperly. Whereas in ASP (and ASP.NET), the <%= %> syntax causes whatever is inside the brackets to be evaluated at render time, the <%# %> brackets unique to ASP.NET are evaluated only during binding. As you will see later in this section, the page and each bindable control on the page have a DataBind() method. The expressions contained within the data binding brackets (<%# %>) are evaluated only when the control's DataBind method is invoked.
That only answers half your question, but Rob Stevenson-Leggett's excellent answer covers everything else. I just thought I'd add this by way of some further illustration.