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.
I use VS 2008 .NET 3.5 SP1 - same thing. Only difference is that I am not using a User Control. Could you please provide me with your ASPX (or any sample that demonstrates the issue), and I will be glad to help.
Thanks,
I cut-n-pasted your sample so the markup is the same as you provided above and it doesn't work. Does your example work in a user control? This should be considered a fairly large bug if it doesn't work within a user control. I cannot cut-n-paste code throughout our product.
Hi SAgosto,
Yes it works perfectly fine. Because i am not acquainted with your exact scenario, i made a sample which is attached to this post. I tried two different scenarios:
1) UserControl1 - the dropdown with an ultraWebTree in the item template, then this UserControl1 is directly put in some ASPX page
2) UserControl2 - contains the actual UltraWebTree, then the ItemTemplate of the WebDropDown contains this UserControl2.
If you still encounter problems, and cannot paste code due to policies and restrictions, I suggest that you contact our Development Support for more in-depth investigation:
http://devcenter.infragistics.com/Protected/SubmitSupportIssue.aspx
Weird. What version are you using? I currently have the trial NetAdvantage for .NET 2009.1 installed. Am I using an older version? Is there a hotfix that I might be missing?
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");
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.