Last post Apr 20, 2008 12:54 PM by Whisky_Fudge
Apr 17, 2008 05:44 PM|Whisky_Fudge|LINK
I have a TreeView inside a UserControl which is not firing the SelectedNodeChanged event. I'm using change set 9278 of the CSS Adapters compiled as a separate assembly. From a quick debug of the issue it seems that the problem surfaces on the line 69 of
if (treeView != null)
Apr 18, 2008 01:00 PM|bdemarzo|LINK
Can you report what is being reported for the Control property one line above (line 68):
TreeView treeView =
Control as TreeView;
Apr 20, 2008 12:54 PM|Whisky_Fudge|LINK
The control I was working on has since been greatly changed, leading me to be unable to repeat that specific bug. However I am still seeing the issue.
I've created a simple website (VS2008, Targeting .net 3.5), added the CSSFriendly dll and browser file. To the default page I've added a user control. The user control contains a simple TreeView within a Panel (for the purpose of this bug the panel is just
a container). The TreeView has a OnAdaptedSelectedNodeChanged event which updates a label with the current time. This does not work as expected. My guess at this point is that the WebControlAdapterExtender.RaiseAdaptedEvent method doesn't not support user
controls which contain a heirachy of elements.
In order to prove this theory I added a quickly hashed together bit of code to the RaiseAdapterEvent method:
MethodInfo method = methodOwner.GetType().GetMethod(delegateName);
if (method == null)
Control parentUserControl = FindParentUserControl(AdaptedControl.Parent);
if (parentUserControl != null)
methodOwner = parentUserControl;
method = methodOwner.GetType().GetMethod(delegateName);
if (method == null)
Lines 1 and 11 in the above snippet are pre-existing. I also added the following method:
private Control FindParentUserControl(Control control)
if (control.Parent == null)
if (control.Parent is UserControl)
Everything started to work as expected, including my original solution.
It would be great to see a more suitable fix in the next change set.