<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.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>CSS Friendly Control Adapters</title><link>http://forums.asp.net/1018.aspx</link><description>Discuss the CSS Friendly Control Adapters sample project, ask questions, post bugs, etc</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Instructions for using the TreeView adapter</title><link>http://forums.asp.net/thread/2752956.aspx</link><pubDate>Tue, 18 Nov 2008 15:38:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2752956</guid><dc:creator>Russ Helfand</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2752956.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=2752956</wfw:commentRss><description>&lt;p&gt;I agree. The alternative event handlers are an imposition, not an advantage. And they do make it more difficult to plug the adapters into existing projects. Trust me, if I could have figured out a way to avoid this alternative event handlering architecture I would have. There are some limitations around what the ASP.NET adapter framework supports and what it doesn&amp;#39;t. Events overrides are not one of the things that are built into the adapter architecture. In fact, it&amp;#39;s what I would consider to be the highest priority missing feature but I&amp;#39;m not sure if the team will address it any time soon.&lt;/p&gt;
&lt;p&gt;The adapted events I created were simply my best shot at solving this gnarly problem. They weren&amp;#39;t intended to be better than the native event handlers. They were meant to simply provide a scheme that would work.&lt;/p&gt;
&lt;p&gt;If you are curious about why I had to use a different name for the event or other details of the implementation I&amp;#39;m afraid I&amp;#39;ll have to think about it a lot more. I solved this problem in this project quite a while ago. I think I chose to name the events uniquely like this because I couldn&amp;#39;t count on the event handler being stipulated as an&amp;nbsp;attribute&amp;nbsp;of the&amp;nbsp;adapted controls&amp;#39; tag. And I couldn&amp;#39;t get to&amp;nbsp;the delegate point itself from the code level.&amp;nbsp;By making a unique/parallel set of&amp;nbsp;pseudo-events like I did for these adapters&amp;nbsp;you end up forcing the&amp;nbsp;developer to&amp;nbsp;provide the right information&amp;nbsp;(the pointer to the&amp;nbsp;function that&amp;nbsp;handles the event) in all cases. The downside, of course, is that the&amp;nbsp;developer has to tweak code, not just plug in the adapters and go. On the other hand, there is already a lot of work involved in using these&amp;nbsp;sample adapters so adding parallel events didn&amp;#39;t seem like too big a stretch!&amp;nbsp;I do&amp;nbsp;regret, though, that&amp;nbsp;I couldn&amp;#39;t find a more elegant and seamless&amp;nbsp;solution. Do forgive me!&lt;/p&gt;
&lt;p&gt;Best regards... PS I rarely monitor this forum any more.&amp;nbsp;Apologies but my plate if quite full with unrelated stuff these days: I&amp;#39;m the web dev for &lt;a href="http://www.microsoft.com/silverlight"&gt;http://www.microsoft.com/silverlight&lt;/a&gt;.&amp;nbsp;So if you don&amp;#39;t hear from me here reliably please don&amp;#39;t be disappointed. I can only spare so much bandwidth for so many things! Good luck...&lt;/p&gt;</description></item><item><title>Re: Instructions for using the TreeView adapter</title><link>http://forums.asp.net/thread/2752239.aspx</link><pubDate>Tue, 18 Nov 2008 10:12:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2752239</guid><dc:creator>dotcomsoftware</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2752239.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=2752239</wfw:commentRss><description>&lt;p&gt;Hi Russ&lt;/p&gt;
&lt;p&gt;What´s the point of creating alternative event handlers? Why not just use the existing ones? Shouldn&amp;#39;t one of the goals of a control adaptor be to not alter&amp;nbsp;either the base control&amp;#39;s functional behaviour or it&amp;#39;s API? That way it makes it easier to plug the adaptor in to existing projects that use the control without having to rework them.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Instructions for using the TreeView adapter</title><link>http://forums.asp.net/thread/2719660.aspx</link><pubDate>Sun, 02 Nov 2008 20:27:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2719660</guid><dc:creator>John.Doe</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2719660.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=2719660</wfw:commentRss><description>&lt;p&gt;These notes are very helpful, however:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I am using a TreeView in a CompositeControl implemented in a DLL. Adding the CSS Adapters to the project breaks the TreeNodeCheckChanged event.&lt;/p&gt;
&lt;p&gt;How do I add the adapted tree node event from the code behind?&lt;/p&gt;</description></item><item><title>Instructions for using the TreeView adapter</title><link>http://forums.asp.net/thread/1393604.aspx</link><pubDate>Fri, 08 Sep 2006 16:09:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1393604</guid><dc:creator>Russ Helfand</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1393604.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1018&amp;PostID=1393604</wfw:commentRss><description>&lt;p&gt;The beta 2 release of the CSS Friendly ASP.NET 2.0 Control Adapter kit supports more sophisticated features for the TreeView than previous releases.&amp;nbsp; There are, however, a few limitations:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;SelectedNodeChanged&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;If you wish to handle the TreeView&amp;#39;s SelectedNodeChanged event, you must add a new attribute called OnAdaptedSelectedNodeChanged to your &amp;lt;asp:TreeView&amp;gt; tag. Set OnAdaptedSelectedNodeChanged equal to the name of a PUBLIC (!!!) function of your page that acts as the event delegate. Typically, you will end up with like this:&lt;/p&gt;&lt;p&gt;&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void OnClick(Object sender, EventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something with foobar.SelectedNode&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;asp:TreeView ID=&amp;quot;foobar&amp;quot; runat=&amp;quot;server&amp;quot; OnSelectedNodeChanged=&amp;quot;OnClick&amp;quot; OnAdaptedSelectedNodeChanged=&amp;quot;OnClick&amp;quot; /&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;TreeNodeCheckChanged&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The TreeNodeCheckChanged event is handled by the adapter in a fashion that parallels the SelectedNodeChanged event. In other words, when using the TreeView adapter, you should add OnAdaptedTreeNodeCheckChanged as a TreeView tag attribute and it should be set to the name of a PUBLIC function in the page that handles the event.&lt;/p&gt;&lt;p&gt;&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void OnCheckChanged(Object sender, TreeNodeEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something with e.Node&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;asp:TreeView ID=&amp;quot;foobar&amp;quot; runat=&amp;quot;server&amp;quot; OnTreeNodeCheckChanged=&amp;quot;OnCheckChanged&amp;quot; OnAdaptedTreeNodeCheckChanged=&amp;quot;OnCheckChanged&amp;quot; ShowCheckBoxes=&amp;quot;Leaf&amp;quot;&amp;gt;&lt;/p&gt;&lt;p&gt;To reiterate, to handle the TreeView&amp;#39;s SelectedNodeChanged or TreeNodeCheckChanged events you must use a new attribute called OnAdapted[eventname].&amp;nbsp; And that attribute must be set to the name of a public (not protected) function that belongs to the page owns the TreeView.&lt;/p&gt;&lt;p&gt;Interestingly, the adapted Treeview handles the TreeNodePopulate event normally so you do not need to add any special attribute like OnAdaptedTreeNodePopulate to handle it.&amp;nbsp; You can use the typical OnTreeNodePopulate attribute or set the delegate programmatically.&amp;nbsp; Further, the delegate function need not belong to the page and can be protected, if you like.&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>