<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx</link><description>All client-side template engines enable you to create HTML (feel free to go ‘duh’). What they don’t all allow is the creation of event handlers and components over the markup they generate. The general approach with those engines is to do a second pass</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx#6808749</link><pubDate>Mon, 29 Dec 2008 19:41:10 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6808749</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;@James: the correct markup for this would probably be &amp;lt;a href=&amp;quot;{{ Util.getBusinessDetailsUrl($dataItem, 'myRatings') }}&amp;quot;&amp;gt;{{Name}}&amp;lt;/a&amp;gt;&lt;/p&gt;
&lt;p&gt;Notice how the binding expression takes the whole attribute value.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6808749" width="1" height="1"&gt;</description></item><item><title>re: Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx#6806294</link><pubDate>Wed, 24 Dec 2008 19:42:51 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6806294</guid><dc:creator>James Shaw</dc:creator><author>James Shaw</author><description>&lt;p&gt;This is a pretty innovative templating engine Bertrand! &amp;nbsp;One quick question:&lt;/p&gt;
&lt;p&gt;What&amp;#39;s the binding expression for the current JSON object? &amp;nbsp;For example, in my template I have&lt;/p&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;javascript:self.location.href=Util.getBusinessDetailsUrl({{this}}, &amp;#39;myRatings&amp;#39;)&amp;quot;&amp;gt;{{Name}}&amp;lt;/a&amp;gt;&lt;/p&gt;
&lt;p&gt;Util.getBusinessDetailsUrl is my own function that takes in the entire bound object, not just a field (&amp;quot;Name&amp;quot; is a field of my object for example). &amp;nbsp;Is {{this}} correct?&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6806294" width="1" height="1"&gt;</description></item><item><title>re: Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx#6771105</link><pubDate>Mon, 08 Dec 2008 08:09:49 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6771105</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;@Edward: nobody claimed the final declarative sample was unobtrusive. Now the markup in the section before that contains only one thing that is not pure HTML: the binding expressions. If you think this is out of place, I guess you would find *any* template engine not pure enough for your taste. Which is fine, you still have plenty of options, but you may be missing on some major productivity gains.&lt;/p&gt;
&lt;p&gt;Now the server-side approach to abstract the client-side stuff is something we've also done (and many, many others too, way before Gaiaware), and it works in many cases but nothing ever beats the pure client approach, if only because you can have a client-side representation of the data.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6771105" width="1" height="1"&gt;</description></item><item><title>re: Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx#6768307</link><pubDate>Sat, 06 Dec 2008 12:35:18 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6768307</guid><dc:creator>Edward</dc:creator><author>Edward</author><description>&lt;p&gt;Steve has a point about its remark kabout jquery. It is not unobtrusive. JQuery is a nice idea as it enables a quick way of doing some nice javascript thingies like animation and stuff. But look &amp;nbsp;at it:&lt;/p&gt;
&lt;p&gt;&amp;lt;img sys:id=&amp;quot;{{ $id(&amp;#39;photo&amp;#39;) }}&amp;quot; sys:src=&amp;quot;{{ &amp;#39;Images/&amp;#39; + Photo }}&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;alt=&amp;quot;{binding FirstName}&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;onclick=&amp;quot;{{&amp;#39;alert(\&amp;#39;You clicked &amp;#39;+FirstName+&amp;#39;\\\&amp;#39;s photo.\&amp;#39;);&amp;#39;}}&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;For me this is far from elegant coding. and yes I don&amp;#39;t want to bother to learn another language or doing things differently.&lt;/p&gt;
&lt;p&gt;Let me explain a bit more. With asp.net you can do most of it server side right? Why not using .NET to do the (ajax)javascript for you and server side too? You have to abstract javascript away from it all. It&amp;#39;s there but you don&amp;#39;t program in it. All the js features like animation, effects, etc should be done server side. &amp;nbsp;This is accomplished for example by gaiaware &amp;nbsp;(&lt;a rel="nofollow" target="_new" href="http://gaiaware.net/"&gt;http://gaiaware.net/&lt;/a&gt;) see some introduction video&amp;#39;s here &lt;a rel="nofollow" target="_new" href="http://tv.gaiaware.net/"&gt;http://tv.gaiaware.net/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I really like it (and use it) because it is unobtrusive, fast,elegant and does allow the creation of event handlers and components over the markup they generate because it is done server side.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6768307" width="1" height="1"&gt;</description></item><item><title>re: Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx#6761931</link><pubDate>Mon, 01 Dec 2008 18:35:11 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6761931</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;@Steve: so if I'm following you, you think unobtrusive means that even the data should be introduced in the template by script? You sure can do that but then the advantages of using templates become pretty small then. But if that's your thing, sure, go ahead and do that. We do support jQuery after all...&lt;/p&gt;
&lt;p&gt;We had something closer to XAML in xml-script three years ago, also experimented with XAML for HTML and JS and it really didn't work very well. The problem is that you're not starting from scratch here like WPF was: you have HTML to deal with. We chose instead to use legal extensions to XHTML and we're quite happy with it. Your feedback is actually one of very few stating this is not the right approach out of overwhelmingly positive feedback. Not saying you're wrong, just that this works better for more people.&lt;/p&gt;
&lt;p&gt;@Dennis: this is just HTML, you can apply that to MVC very easily. You can for example use a JSON result as the server data source. For the master page scenario, you can actually do the namespace declaration on the dataview's tag, and it will work just as well as on body. You can also call Sys.Application.processNode or processNodes to avoid having to touch body to activate the DOM.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6761931" width="1" height="1"&gt;</description></item><item><title>re: Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx#6761818</link><pubDate>Mon, 01 Dec 2008 16:17:30 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6761818</guid><dc:creator>Dennis</dc:creator><author>Dennis</author><description>&lt;p&gt;Bertrand - Do you have any samples that would use the MVC project as a starting point? &amp;nbsp;Data sources from controller methods as well as usage of the template engine in a project that has master pages (where the &amp;lt;body&amp;gt; is not present in each .aspx page.&lt;/p&gt;
&lt;p&gt;Thanks, Dennis&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6761818" width="1" height="1"&gt;</description></item><item><title>re: Instantiating components on template markup</title><link>http://weblogs.asp.net/bleroy/archive/2008/11/28/instantiating-components-on-template-markup.aspx#6760216</link><pubDate>Sun, 30 Nov 2008 00:07:27 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6760216</guid><dc:creator>Steve</dc:creator><author>Steve</author><description>&lt;p&gt;Interesting. &amp;nbsp;But I&amp;#39;m not seeing the &amp;#39;unobtrusive&amp;#39; part.&lt;/p&gt;
&lt;p&gt;ie. jQuery is &amp;#39;unobtrusive&amp;#39;.&lt;/p&gt;
&lt;p&gt;I think unobtrusive would be completely separated from the html. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Unobtrusive to me would be that I could have 3 html pages of the exact same content with 3 different css styles or js files that &amp;#39;act upon&amp;#39; the html. &amp;nbsp;The html would be untouched by it.&lt;/p&gt;
&lt;p&gt;To be honest, I&amp;#39;d rather see MS go a different route here: you have WPF for windows apps - xaml. &amp;nbsp;Silverlight with xaml. &amp;nbsp;How about creating xaml on the web as well ?&lt;/p&gt;
&lt;p&gt;Basically a xaml based view engine. &amp;nbsp;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6760216" width="1" height="1"&gt;</description></item></channel></rss>