Gets/sets a value that is used to store a dataset key or other information.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Property DataKey As Object |
| C# | |
|---|
public object DataKey {get; set;} |
Remarks
Example
The following sample code illustrates some of the information available in the BeforeExpand event.
For an overview of how to handle events in Visual Basic or Visual C#, see
Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see
Consuming Events in the
.NET Framework Developer's Guide.
| Visual Basic | Copy Code |
|---|
Imports Infragistics.Win.UltraWinTree
Private Sub ultraTree1_BeforeExpand(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.CancelableNodeEventArgs) Handles ultraTree1.BeforeExpand
Dim sb As New System.Text.StringBuilder()
sb.Append("Node: ")
sb.Append(e.TreeNode.Key)
sb.Append(" is about to be expanded.")
Debug.WriteLine(sb.ToString())
End Sub
|
| C# | Copy Code |
|---|
using System.Diagnostics;
using Infragistics.Win.UltraWinTree;
private void ultraTree1_BeforeExpand(object sender, Infragistics.Win.UltraWinTree.CancelableNodeEventArgs
e)
{
// Note: In order to load node collections on demand, set
// the appropriate Override object's 'ShowExpansionIndicator'
// property to 'CheckOnExpand'. Then in this event place
// logic to add the child nodes to the node being expanded
// (e.g. with the e.TreeNode.Nodes's 'Add' or 'AddRange'
methods).
//
// In addition to its 'Tag' property the node exposes
// a 'DataKey' property (which is also opaque to the node).
// It is often useful with 'CheckOnDemand' to associate
// some identifier/key of a corresponding row in a dataset.
//
// With 'CheckOnExpand' specified, if this event is called
// and no child nodes are added then the expansion indicator
// will disappear and this event will not fire again.
//
// However, this can be reset by calling the UltraTree's
// 'ResetExpansionIndicator' method to re-show the expansion
// indicator and re-fire this event when the user expands the
// node again.
//
// Refer to the 'UltraTree Load On Demand CS' sample.
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("Node: ");
sb.Append(e.TreeNode.Key);
sb.Append(" is about to be expanded.");
Debug.WriteLine( sb.ToString() );
// Note : This action can be canceled by the following line of
code.
//e.Cancel = true;
}
|
See Also