Thursday, March 29, 2012

Server side tag syntax?

I'm using a sample of course code that has server-side tags in different syntaxes, and I don't understand the difference between them:

<%$ ConnectionString:bnDefaultCS%>

<%# Country%>

I can't find a help file or web page that explains the difference (probably because search engines ignore those characters).

What does the $ mean and what does the # mean? are there any others I'm missing?


<%# Country%> // DataBinding (binds the property value)

Country is a public property of the page probably... something like Public String Coutry... in the codebehind.

<%$ ConnectionString:bnDefaultCS%> // If i am not mistaken this is called 'expressions' Where ConnectionString is the expresion and bnDefautlCS is the param it expects, kind of. so for example with resources.. it looks like<%$Resources:Class,ResourceID%>

Is declaritve syntax for special elements that can be created in the frameowrk.

So for example <%$ ConnectionString: is telling the frameowrk to look in web.config and find the connectionString "bnDefaultCS" ( the same type of stuff is used for resource files. )

There is proably a much nicer, more technical answer someone will probaly add to this thread, but as far as functionality that is the basics.

0 comments:

Post a Comment