Per a previous thread, it was suggested to use put the UltraTreeView control within the WebDropdown control's ItemTemplate tag. Visual Studio 2008 removes the reference from the designer. If manually put in, the control is NULL. If I copy the markup outside of the WebDropDown, the reference within the designer is added and the control works as expected.
I have a need for the TreeView control to be in either a dropdown or a combobox type control. Is this possible? Please provide a sample so I can implement within my proof-of-concept.
Thanks.
Hi,
Here is the code that will embed an UltraWebTree inside the DropDown's container. Note that you can further improve this example by removing hover/selected style for the dropdown item (so that you don't get any color change while you manipulate the actual Ultra Web Tree). Also you can turn off EnableClosingDropDownOnSelect=false, so that the dropdown doesn't close when you manipulate the UltraWebTree. From there on, you can set / get values from the ultra web tree to the dropdown using client-side events, as it is shown in the WebDataGrid template sample in the WebDropDown 2009.1 samples.
Also note there is only 1 DropDown item in the items collection, because if you have more, it will create an instance of the UltraWebTree for every item, so you will get many UltraWebTrees rendered one after another in the DropDown container.
<ig:WebDropDown runat="server" ID="WebDropDown2" Width="200px">
<Items>
<ig:DropDownItem Text="something"></ig:DropDownItem>
</Items>
<ItemTemplate>
<ignav:UltraWebTree ID="UltraWebTree1" runat="server">
<Nodes>
<ignav:Node Text="Root 1">
<ignav:Node Text="Child 1"></ignav:Node>
<ignav:Node Text="Child 2"></ignav:Node>
<ignav:Node Text="Child 3"></ignav:Node>
</Nodes>
</ignav:Node>
<ignav:Node Text="Root 2"></ignav:Node>
<ignav:Node Text="Root 3"></ignav:Node>
</ignav:UltraWebTree>
</ItemTemplate>
</ig:WebDropDown>
Hope it helps,
Angel
This code does not work for me. It'sthe same exact problem as described above:
The control is not referenced within the designer
Clicking on the dropdown control's button doesn't do anything
What version of Visual Studio / .NET Framework are you using? I am using VS2008 SP1 and Framework 3.5. The markup is within a user control.
The above code does not compile. You need to cast it to the UltraWebTree type:
UltraWebTree tree = (UltraWebTree) WebDropDown1.Items[0].FindControl("UltraWebTree1");
Also, this does not work within an Intersoft control. The hardcoded Item is NULL and the control is not added. However, it does appear to workoutside of this control. I am not sure why.
I see - you cannot access the UltraWebTree1 directly, if it is in template. you need to use:
(C#)
UltraWebTree tree = WebDropDown1.Items[0].FindControl("UltraWebTree1");
Thanks,
I am referring to the file WebUserControl.ascx.designer.cs which does not contain a reference to UltraWebTree1. UltraWebTree2 is automatically added to the designer file and is not null as it is not within that ItemTemplate tag. If I manually add UltraWebTree1, the object is NULL in the codebehind. Please refer below to the markup that I manually add. Also, in the WebUserControl page's code behind, I am checking both TreeView (the one within the WebDropDown's ItemTemplate tag and a TreeView outside of the WebDropDown control for NULL. In my example, it is always null and the condition uses a Response.Write statement to print "UltraWebTree1 is null".
In your example that uses just markup, it works fine but I need to be able to access these controls via code behind as well. Are you saying your UltraWebTree1 isn't NULL in the codebehind?
///
<summary>
UltraWebTree1 control.
</summary>
<remarks>
Auto-generated field.
To modify move field declaration from designer file to code-behind file.
</remarks
protected global::Infragistics.WebUI.UltraWebNavigator.UltraWebTree UltraWebTree1;
Hello Shawn,
I have ran your example and can see the designer, and the sample runs fine. I am not sure i understand what steps exactly you are performing in hte designer.
I am attaching a screenshot which shows the designer of the page, as well as the UltraWebTree, when it's in the dropdown template.
My environment:
VS 2008, .NET 3.5 SP1
Windows Vista
IG version: latest dev version, if there are any changes which weren't in the last public service release, they will be in this month's service release.
This bug still exists. I upgraded to the Hotfix 2040 version and your archive (after I changed the web.v2 references) worked, only if, the tree was just in markup. The designer still removes the reference and the object is still null in the code behind. This is a critical bug so please advise.
Please see the specified URL for the modified version so you can review.