<?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>Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx</link><description>A comment on this post is asking whether it is possible to create bindings outside of a template. The point of doing that is that you don’t necessarily want to render a template just to set-up a few bindings. Well, bindings are really implemented by a</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6695054</link><pubDate>Tue, 21 Oct 2008 05:11:56 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6695054</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;@Corey: yes, you can use it purely on the client-side but there is little documentation for that currently. There is a specific download for just the client files on the releases page. The scripts that you need are CommonToolkitScripts, DateTimeScripts, PopupExtender, AnimationScripts, ThreadingScripts. You'll also need the calendar css and of course the CalendarBehavior script. The behavior can be instantiated using $create.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6695054" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6695014</link><pubDate>Tue, 21 Oct 2008 04:55:58 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6695014</guid><dc:creator>Corey J gaudin</dc:creator><author>Corey J gaudin</author><description>&lt;p&gt;Bertrand,&lt;/p&gt;
&lt;p&gt;Can you utilize that Calendar completely Client-side? I have used it Server Side, but I am using it on the latest blog post (using Client Template and MVC ASP.NET) on &lt;a rel="nofollow" target="_new" href="http://polymorphicview.blogspot.com/2008/10/update-to-json-service-provider-using.html"&gt;polymorphicview.blogspot.com/.../update-to-json-service-provider-using.html&lt;/a&gt; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am trying to bind a client side only Calendar control to that textbox that doesnt mess up the Live Template binding to it. The jQuery Datepicker breaks the Template Binding to it. I figured the Calendar Picker built into AJAX Toolkit would work, but have no idea how to utilize it completely client-side.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6695014" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6694918</link><pubDate>Tue, 21 Oct 2008 04:18:06 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6694918</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;@Corey: I haven't tried the jQuery Datepicker but you can absolutely 2-way bind a textbox to a date. The trick is to use a convert function and a convertBack function on the binding to go from date to string and from string to date. The functions can use String.format and Date.parseLocale. We do have a date picker in the Ajax Control Toolkit: the Calendar behavior. &lt;a rel="nofollow" target="_new" href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx"&gt;www.asp.net/.../Calendar.aspx&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6694918" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6694451</link><pubDate>Tue, 21 Oct 2008 01:12:02 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6694451</guid><dc:creator>Corey J gaudin</dc:creator><author>Corey J gaudin</author><description>&lt;p&gt;How do you 2-way bind a date to a textbox control? When I utilize this AJAX &amp;nbsp;Client Templating to bind to a textbox and add the jQuery Datepicker, it goes all nuts. Changing the Date on the textbox changes it to a string and doesnt really 2-way bind correctly. Is there some Datepicker associated with this library I can use to test so that it maps to and from the Javascript Object seamlessly?&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6694451" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6690603</link><pubDate>Sun, 19 Oct 2008 19:37:08 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6690603</guid><dc:creator>Drew Marsh</dc:creator><author>Drew Marsh</author><description>&lt;p&gt;Bertrand,&lt;/p&gt;
&lt;p&gt;Yeah, a coworker gave it a shot shortly after he saw my comment and we saw that it worked. I deserve a smack for not trying it before asking. :P It&amp;#39;s just that it&amp;#39;s not shown anywhere in the Road Map being used that way and it&amp;#39;s always talked about in the context of templates so I thought maybe we regressed somehow.&lt;/p&gt;
&lt;p&gt;Anywho, glad to see it works and looking forward to new info @ the PDC next week!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Drew&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6690603" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6682693</link><pubDate>Thu, 16 Oct 2008 06:31:02 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6682693</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;@Drew: I'm certainly not going to smack you but the exact code that is in your comment will work just fine provided you write the button and textbox controls (or re-use the old ones from Futures). The sys:attach attributes will work just anywhere and once it's been parsed the rest of the tag is fully activated. It's a binding on its own that will need to be in a template.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6682693" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6682666</link><pubDate>Thu, 16 Oct 2008 05:49:19 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6682666</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;@gramic: just looking at all attributes on all elements will kill initial performance. The way activate works, it only has to look at one thing on each element: sys:attach. I hope this clarifies.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6682666" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6681985</link><pubDate>Wed, 15 Oct 2008 10:15:57 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6681985</guid><dc:creator>gramic</dc:creator><author>gramic</author><description>&lt;p&gt;Using markup that way is much better then using Sys.Binding class from code. I saw that it is possible to set &amp;nbsp;sys:activate=&amp;quot;*&amp;quot; &amp;nbsp;at the parent tag of the template.&lt;/p&gt;
&lt;p&gt;Even that I thought about a way to data bind without creation of any template compilation but just parse properties. &lt;/p&gt;
&lt;p&gt;As in your example: the DOM elements are already created and the data binding markup is in the properties too. Maybe just tracing the DOM properties and do the Data Binding will suffice and will not take the performance away.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6681985" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6681728</link><pubDate>Wed, 15 Oct 2008 04:43:34 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6681728</guid><dc:creator>Mojtaabaa</dc:creator><author>Mojtaabaa</author><description>&lt;p&gt;thanks for the article.i am digesting it! ;)&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6681728" width="1" height="1"&gt;</description></item><item><title>re: Hack: using live bindings outside templates</title><link>http://weblogs.asp.net/bleroy/archive/2008/10/14/hack-using-live-bindings-outside-templates.aspx#6681419</link><pubDate>Tue, 14 Oct 2008 23:04:23 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6681419</guid><dc:creator>Drew Marsh</dc:creator><author>Drew Marsh</author><description>&lt;p&gt;Totally! So what&amp;#39;s the solution for the simple scenario that I want to have an &amp;lt;input type=text/&amp;gt; in my page and an &amp;lt;input type=submit&amp;gt; and want to hook up the TextBox and Button controls to those to have some behavior? In XMLScript I would have done:&lt;/p&gt;
&lt;p&gt;&amp;lt;script language=&amp;quot;text/xml-script&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;lt;page&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;components&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;textbox id=&amp;quot;myTextBox&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;lt;button id=&amp;quot;myButton&amp;quot; click=&amp;quot;doSomething&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;/components&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;lt;/page&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;Now I would expect to just be able to do:&lt;/p&gt;
&lt;p&gt;&amp;lt;input type=&amp;quot;text&amp;quot; sys:attach=&amp;quot;textbox&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;input type=&amp;quot;submit&amp;quot; sys:attach=&amp;quot;button&amp;quot; button:click=&amp;quot;doSomething&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;Where &amp;quot;doSomething&amp;quot; is just a global JS method in my page that does some processing in response to the click event like grab the textbox and check to make sure it has a valid value first.&lt;/p&gt;
&lt;p&gt;AFAIK this scenario just isn&amp;#39;t possible anymore, so unless you&amp;#39;re doing templating the markup extensions are completely useless, right? Therefore you&amp;#39;re forced to write JavaScript to $create the static controls on your page.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Drew&lt;/p&gt;
&lt;p&gt;P.S. Admittedly I haven&amp;#39;t had time to tinker enough with the new bits to know for sure, so feel free to smack me and point me to a sample if it is indeed possible. ;)&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6681419" width="1" height="1"&gt;</description></item></channel></rss>