Updating Radtreeview data with Datasource

4 posts, 0 answers
  1. matt
    matt avatar
    4 posts
    Member since:
    Aug 2011

    Posted 05 Aug 2011 Link to this post

    Hi,

    I am looking for some help as I am new to this control.

    I have set up a RadTreeView to pull data from an Oracle database via the Datasources option. I have been able to load 3 levels of data. Now, I want to be able to edit the data on the treeview and that update be replicated back to the oracle database.

    Thus far I have come up with the following. However I think I am missing something.

    When I update a Node, the data is saved back to the database but the child nodes on the treeview dissapear (since the parent has now changed). I cannot find a way of refreshing the treeeview. Can somebody please help??

     

    Private Sub RadTreeView1_Edited(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.TreeNodeEditedEventArgs) Handles RadTreeView1.Edited

     

     

    On Error GoTo ErrMsg

     

     

    Dim DBConnection As New OleDbConnection("Provider=msdaora;Data Source=ubrmos01;User Id=tiadmin;Password=******")

     

     

    Dim strsql As String

     

     

    If e.Node.Level = 0 Then

     

    DBConnection.Open()

    strsql =

    "UPDATE APPLICATION set APPLICATION = " & "'" & e.Node.Text & "'" & " where APPLICATION = " & "'" & Text_beforeedit & "'"

     

     

    Dim Command As New OleDbCommand(strsql, DBConnection)

     

    Command.ExecuteNonQuery()

     

    End If

     

     

    If e.Node.Level = 1 Then

     

    DBConnection.Open()

    strsql =

    "UPDATE ENVIRONMENT set ENVIRONMENT = " & "'" & e.Node.Text & "'" & " where ENVIRONMENT = " & "'" & Text_beforeedit & "'"

     

     

    Dim Command As New OleDbCommand(strsql, DBConnection)

     

    Command.ExecuteNonQuery()

     

    End If

     

     

    Exit Sub

     

    errmsg:

    e.Node.Text = Text_beforeedit

    MsgBox(Err.Description, MsgBoxStyle.Critical,

    "Error Updating Database")

     

     

    End Sub

     

  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 10 Aug 2011 Link to this post

    Hi Matt,

    Thank you for contacting us.

    If you are saving the changes using SQL Update queries, you should refresh the data source referenced by the RadTreeView. You can do that by fetching a fresh copy from your data base. Nevertheless, I have enclosed a better approach that uses ADO.NET Table adapters.

    Kind regards,
    Svett
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. UI for WinForms is Visual Studio 2017 Ready
  4. matt
    matt avatar
    4 posts
    Member since:
    Aug 2011

    Posted 10 Aug 2011 Link to this post

    Thanks.

    I am unable to open the file. I am using Visual Studio 2008; can you save a compatible version?
  5. Svett
    Admin
    Svett avatar
    728 posts

    Posted 12 Aug 2011 Link to this post

    Hi Matt,

    I am enclosing the Visual Studio 2008 version of the project.

    Kind regards,
    Svett
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top