I have a project that has 2 webdatatree's, when the page loads only one is active. When you click on a node it should load data into the other one. I have binding setup in the code behind and when I use the debugger it is binding the last loaded dataset into the first webdatatree and errors because that dataset should be loaded into the second webdatatree. Can you have 2 webdatatrees on one page and bind them in code???
Thanks
Hi Alex,
This is my first time working with the WebDataTree. Using 2013.2. The concept of databinding to the WebDataTree is so different than what I used to with other controls such as WebGrid, ComboBox, etc... Here I have a simple OracleDataReader, one column and would like the data to display on the WebDataTree and after all set and done, it only display list of "Infragistics.Web.UI.Framework.Data.DataSetNode". My OracleDataReader returns only one column, 5 rows, ie: {A, B, C, D, E} My code to bind to the control as follow:
DataSet ds = new DataSet("menuData");
DataTable dt = new DataTable("Commodity");
LookupData obj = new LookupData();
OracleDataReader objDR = obj.GetCommodityList();
string strTableName = objDR.GetSchemaTable().TableName;
dt = objDR.GetSchemaTable();
dt.PrimaryKey = new DataColumn[1] { dt.Columns[0] };
while(objDR.Read())
{
dt.Rows.Add(objDR[0]);
}
ds.Tables.Add(dt);
MenuTree.DataSource = ds;
MenuTree.DataBind();
My Client properties:
<ig:WebDataTree ID="MenuTree" runat="server" CheckBoxMode="BiState" Height="100%" SelectionType="Single" Width="100%">
<DataBindings><ig:DataTreeNodeBinding DataMember="<%= strTableName %>" TextField="Commodity_Code" /></DataBindings></ig:WebDataTree>
Would you please help and let me know where I did wrong or any suggestions with example codes? All I wanted to be able to bind a OracleDataReader or a Dataset straight from the database to the WebMenuTree control. Thanks much.
Hello Erik,
Inform me if you have further questions.
I have created a sample with two trees and with two Data Sets. The sample is working as expected in this situation also.
Test the example and inform me if you have additional questions.
Maybe I wasn't clear, so I will try this again:
[What I have in code]
WDT1 - binds to DS1
WDT2 - binds to DS2
[What happens during runtime]
WDT1 - binds to DS2 and throws an error because they are not setup the same and the columns names are nothing like the columns names for DS1.
I have 2 datasets and 2 webdatatrees.
Hopefully that will help.
Erik
Hello normalit,
I have created a simple example (attached in the message) based on your scenario in which I bind the second tree with the same “DataSet” with which I bind the first one, on node selection change event.
The second tree is disabled at first and when selection is made in the first tree second tree is enabled again and bind with the data from the “DataSet”.
Test this sample and let me know if you have additional questions.