Hi,
I have an UltraTree databound to an UltraDataSource; essentially each band of my datasource contains one column, therefore making my UltraTree display very similar to an ordinary Windows Tree-List. The reason I'm using UltraTree instead of just the basic Windows TreeList is that the TreeList doesn't support data binding. Secondly, I will have this one DataSource shared among many UltraTrees within different tab-pages of my form, so that a single update to the DataSource (rows) will automatically be reflected on all bound UltraTrees. And here is my question...
I need have my UltraTree object be able to access the Tag object of a particular row from the DataSource. How?
Essentially, from my UltraTree-AfterSelect-Event handler, I will only know which node of my UltraTree was selected. How can I correspond this node to the original row in the DataSource, so that I can access the Tag object of that row?
-kel-
I populate a datasource with rows and add an object to the Tag property. (Four columns are available in the UltraWinGrid I use; checkbox, string, dropdown, dropdown)
The code to populate the datasource of the UltraWinGrid is:
UltraDataRow looRow = lodsFailureModes.Rows.Add(); looRow["FM"] = looFMTemplate.Mode; looRow["FMD"] = "Detected"; looRow["FME"] = "Dangerous"; looRow.Tag = looFMTemplate;
looFMTemplate is the object which I like to access and lodsFailureModes is the datasource.
One of the rows contains a checkbox and I use the CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) event handler of the UltraWinGrid to handle the check event. I try to access the underlying object by accessing the e.Cell.Row.Tag property but this property holds the null value. I am sure when I assign the looFMTemplate object to the looRow.Tag property it is not null.
What am I doing wrong?
--> UPDATE: I found the problem I need to access the e.Cell.Row.ListObject.Tag property !!
WOW, that was a lot easier than I had expected. Thanks Mike.
Essentially, the code i put into the AfterSelectEventHandler would look like this...
if (e.NewSelections.Count <= 0) return;object obj = ((UltraDataRow)e.NewSelections[0].ListObject).Tag;
Hi kel,
The ListObject property of the node will return you the underlying data list object that the node represents. So from there you can access any properties of the object you need.