Hai ,
Give A solution To add a child node in selected parent node..
Hi JayaManickam,
Thank you for posting in our forums.
You can access the selected nodes from the SelectedNodes collection and then add a new node by using the Add method of the selected node’s Nodes collection.
I have attached a small sample which demonstrates this suggestion.
Please let me know if you have any additional questions.
Dear Sir,
In My ultra tree view is data binding. How to Insert a Parent and child using tree view?? Please Help me..
My Project is WindowsApplication. I attach screenshot below please find it
Thank you for the reply.
If your tree is databound, in order to add a child node, you need to add a record directly to the underlying data source. If you are using DataSet you need to have a data table that represents the child node that you will add and then add a new row to this child data table. If you are using a List<T> or BindingList<T> you can get the underlying object (which must contain another list of objects for the children) by using the ListObject property of the node and then you can add a new object to the list of children.
Hi Dimitar
Thanks For your response. Iam New in this platform.
Iam using CSLA BindingList<T>. This is my class. Could you please briefly explain
Imports CslaImports Csla.DataImports System.Data.SqlClientImports System.Data.Sql<Serializable()> _Public Class DeprtList Inherits Csla.ReadOnlyListBase(Of DeprtList, DepartInfo)
#Region "Business Method"
Public Shared Function GetDepartmentList(ByVal dr As SafeDataReader) As DeprtList Return DataPortal.Fetch(Of DeprtList)(dr) End Function
Public Shared Function GetNewDeprtList() As DeprtList Return New DeprtList End Function
Public Shared Function GetDeprtList() As DeprtList Return DataPortal.Fetch(Of DeprtList)(New Criteria) End Function
Private Sub New() ' require use of factory methods End Sub#End Region#Region "DATA ACCESS" <Serializable()> _ Private Class Criteria
End Class
<Serializable()> _ Private Class DeprtIdCriteria Private mId As Integer Public Sub New(ByVal id As Integer) mId = id End Sub Public ReadOnly Property Id As Integer Get Return mId End Get End Property End Class
Private Overloads Sub DataPortal_Fetch(ByVal criteria As Criteria)
Fetch()
End Sub
Private Overloads Sub DataPortal_Fetch(ByVal dr As SafeDataReader)
Fetch(dr)
Private Sub Fetch()
Using cn As New SqlConnection(Database.GetConnectionstring) cn.Open() Using cm As SqlCommand = cn.CreateCommand With cm .CommandType = CommandType.StoredProcedure .CommandText = "DepartmentList" Using dr As New SafeDataReader(.ExecuteReader) Fetch(dr) End Using End With End Using End Using End Sub
Private Sub Fetch(ByVal dr As SafeDataReader) RaiseListChangedEvents = False IsReadOnly = False While dr.Read Dim Info As New DepartInfo(dr) Me.Add(Info) End While IsReadOnly = True RaiseListChangedEvents = True End Sub#End Region
Implementing this would depend on what exactly your goal with this feature is. Are you going to save the added nodes to your data source? Are you allowing adding child nodes only to the first level? Or the user can keep adding nodes even to the child nodes? What are these parent nodes representing in your data source?
As I explained in my previous reply you need to be able to add the new record directly to the underlying data source. This means that the class that represents the parent node (it seems that in your case it is DepartInfo) must have a BindingList<T> property for the child nodes, where T is the class that represents the information in your child nodes. The code for this would be something like this:
If Me.ultraTree1.SelectedNodes.Count > 0 Then
Dim selectedNode = Me.ultraTree1.SelectedNodes(0)
Dim deptInfo = TryCast(selectedNode.ListObject, DepartInto)
If deptInfo IsNot Nothing Then
deptInfo.Children.Add(New Child())
End If
Let me know if you have any additional questions.
Thanks for your response. I solve my problem. Thanks For assist at correct time.
Hai Dimitar,
I have Doubt in ultratoolbar manager. How to move a group in single tab. I attach a screen shot. For ex I want to move a synchronics ribbon group move to first place