I am converting Infragistics 2010 v2 CLR3.5 to Infragistics 2014 v2 using 4.5 CLR using Visual Studio 2013 Professional Update 4. I am getting following error while building the project. Please reply immediately..........Try to give solution of below code of using alternative of Levels instead of changing whole functionality. Let me know the alternative of using "Levels" in the existing code plzzzz.
Below error is there while trying to load to get MenuList where "UltraWebTree" being used previously. Now I am upgrading to "WebDataTree" to get functionality, due to which in WebDataTree1 - related to Levels the error is coming:
Error 324 'Infragistics.Web.UI.NavigationControls.WebDataTree' does not contain a definition for 'Levels' and no extension method 'Levels' accepting a first argument of type 'Infragistics.Web.UI.NavigationControls.WebDataTree' could be found (are you missing a using directive or an assembly reference?)
Code is given below:
menuDS.Tables.Add(mnu3Table); menuDS.Tables.Add(mnu2Table); menuDS.Tables.Add(mnu1Table); UltraWebTree1.Levels[0].ColumnName = "Menu2_Nm"; //WebDataTree1.Nodes[0].Levels[0].ColumnName = "Menu2_Nm"; see this it is not taking Levels of above line, here i need alternative as I can't change code
WebDataTree1.Levels[0].LevelKeyField = "Menu2_ItemID"; if (menuDS.Tables["Menu3"].Rows.Count > 0) { menuDS.Relations.Add("MenuLevel1", menuDS.Tables["Menu2"].Columns["Menu2_ID"], menuDS.Tables["Menu3"].Columns["Menu3_parentID"]); WebDataTree1.Levels[0].RelationName = "MenuLevel1"; //here also same error coming WebDataTree1.Levels[1].ColumnName = "Menu3_Nm"; //here also same error coming WebDataTree1.Levels[1].LevelKeyField = "Menu3_ItemID"; //here also same error coming } if (menuDS.Tables["Menu4"].Rows.Count > 0) { menuDS.Relations.Add("MenuLevel2", menuDS.Tables["Menu3"].Columns["Menu3_ID"], menuDS.Tables["Menu4"].Columns["Menu4_parentID"]); WebDataTree1.Levels[1].RelationName = "MenuLevel2"; WebDataTree1.Levels[2].ColumnName = "Menu4_Nm"; WebDataTree1.Levels[2].LevelKeyField = "Menu4_ItemID"; } WebDataTree1.DataSource = menuDS; WebDataTree1.DataMember = "Menu2"; WebDataTree1.DataBind(); } }
Hello,
The WebDataTree uses bindings and collections of nodes, these topics can help you our as there are also data source options available:
http://help.infragistics.com/Doc/ASPNET/2014.2/?page=WebDataTree_Binding_to_Data.html [edited]
The smart tag designer can be very helpful too.
Full API listing: http://help.infragistics.com/Doc/ASPNET/2014.2/?page=WebDataTree_API_Overview.html
There are also online samples: http://ko.infragistics.com/samples/aspnet/data-tree/data-binding
Let me know if you need further assistance.
Regards,
Damyan Petev
Associate Software Developer
Infragistics, Inc.
I went through the links provided by you. But I am not able to identify an alternative for "Levels" in the following code:
WebDataTree1. Levels[0].RelationName = "MenuLevel1"; WebDataTree1.Levels[1].ColumnName = "Menu3_Nm"; WebDataTree1.Levels[1].LevelKeyField = "Menu3_ItemID";
Please suggest me the solution for this.......!!
If the sample doesn't make it clear enough, but really the only thing needed is the binding assignments. So, as I mentioned the WebDataTree uses bindings (DataTreeNodeBinding to be exact) and collections of nodes which can be manipulated manually as well. Bindings have text, value and the equivalent of levels where their depth property matches the level index, e.g.:
<ig:WebDataTree ID="WebDataTree1" runat="server" Height="300px" Width="430px">
<DataBindings>
<ig:DataTreeNodeBinding ValueField="UnitPrice" TextField="Title" ImageUrlField="ImageUrl" Depth="0" />
</DataBindings>
</ig:WebDataTree>
OR the same thing in C#:
DataTreeNodeBinding binding = new DataTreeNodeBinding();
binding.ValueField = "UnitPrice";
binding.TextField = "Title";
binding.ImageUrlField = "ImageUrl";
binding.Depth = 0;
this.WebDataTree1.DataBindings.Add(binding);
You can check out this post for details: http://ko.infragistics.com/community/forums/t/77396.aspx
In your case you can define either DataMember or Depth (which is the level index) since it is a DataSet binding and the tree will automatically detect relations so no need for those. So your binding should look something like this:
DataSet set = new DataSet();
//Add two tables
set.Tables.Add(BuildTable("Menu2"));
set.Tables.Add(BuildChildTable("Menu3"));
//Create relations
DataColumn parentColumn = set.Tables["Menu2"].Columns["Menu2_ItemID"];
DataColumn childColumn = set.Tables["Menu3"].Columns["Menu3_parentID"];
DataRelation relation = new DataRelation("RelationName", parentColumn, childColumn);
set.Relations.Add(relation);
binding.ValueField = "Menu2_Nm";
binding.TextField = "Menu2_Nm";
binding.KeyField = "Menu2_ItemID";
binding.DataMember = "Menu2"; // or binding.Depth = 0;
this.WebDataTree2.DataBindings.Add(binding);
binding = new DataTreeNodeBinding();
binding.ValueField = "Menu3_Nm";
binding.TextField = "Menu3_Nm";
binding.KeyField = "Menu3_ItemID";
binding.DataMember = "Menu3"; // or binding.Depth = 1;
this.WebDataTree2.DataSource = set;
this.WebDataTree2.DataBind();
Keep in mind that the Aikido controls are built on a completely different framework and their behaviors and properties will be different compared to their Classical Controls counterparts. That means such API are completely expected and it's highly recommend getting to know the newer active versions of the controls.
I've attached a sample for you with DataSet and IEnumerable binding just in case.
Example don't solve yet my purpose in fixing the code.. I tried it
Hi........The code which I pasted is old Infragistics code and basically it is doing
[ DataSet ds = Page_WEB.webApp.GetMenuList(_groupNm, Context.User.Identity.Name.ToString()); ]
Keeping in mind of my code, I would like to know the alternative for "Levels" being used in that code as well as "LevelKeyField" because WebDataTree does not contain the definition for "Levels".
Please provide the solution for this how I can fix this.....
As explained above and in linked post, the equivalent of Levels is the DataBindings collection and each binding is equivalent to each level definition.
Levels Property: Returns a reference to a Levels collection that represents each particular hierarchical level of the tree. This is the DataBindings collection in the new control.
Please refer again to the code above:
- Each level is a DataTreeNodeBinding: This class controls the databinding process of populating the properties of each bound node to the data fields in the datasource.
- These are added to the DataBindings collection not Levels:
Note that the WebDataTree will perform auto mapping of bindings to provided data so properties of the bindings must be accurate. Also notice that the bindings have a KeyField which is the LevelKeyField:
Please examine the sample code above as I tried to replicate your initial code (including DataTables, relations and column names) and without further information I cannot reproduce any error you might be seeing.
If this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.