This is a migrated thread and some comments may be shown as answers.

TreeView Not Refreshing

1 Answer 95 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
PJ Rodriguez
Top achievements
Rank 1
PJ Rodriguez asked on 22 Jun 2010, 01:38 AM
I have a Radtreeview residing inside a splitter that I build manually using the following code:

    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        If Not IsPostBack Then 
 
            buildTree()  
            RadTreeView1.ExpandAllNodes()  
        End If 
        setValues()  
 
 
    End Sub 
    Private Sub buildTree()  
        RadTreeView1.Skin = "Forest" 
 
 
        Dim connect As New SqlConnection(ConfigurationManager.ConnectionStrings("CouncilAgendaConnectionString").ConnectionString)  
        connect.Open()  
        Dim dsAgenda As New DataSet  
 
        Dim yearTable As New DataTable  
        Dim councilMeetingTable As New DataTable  
 
        Dim ConsentAgendaTitleTable As New DataTable  
        Dim otherApprovalsTitleTable As New DataTable  
        Dim consentAgendaTable As New DataTable  
        Dim consentAgendaExhibitsTitleTable As New DataTable  
 
        Dim minutesTitleTable As New DataTable  
        Dim minutesTable As New DataTable  
 
        Dim callToOrderTitleTable As New DataTable  
 
        Dim citizenCommentsTitleTable As New DataTable  
 
        Dim publicHearingsTitleTable As New DataTable  
        Dim publicHearingsSubTitleTable As New DataTable  
        Dim publicHearingsTable As New DataTable  
 
        Dim ordinancesTitleTable As New DataTable  
        Dim ordinancesCommitteesTable As New DataTable  
        Dim ordinancesCommitteesABTable As New DataTable  
 
        Dim reportsTitleTable As New DataTable  
        Dim reportsCommitteesTable As New DataTable  
        Dim reportsAgendaABTable As New DataTable  
        Dim reportsDiscussionTitleTable As New DataTable  
        Dim reportsDiscussionTable As New DataTable  
 
        Dim staffReportsTitleTable As New DataTable  
        Dim staffReportsTable As New DataTable  
 
        'Start SQL Queries  
        Dim yearAdapter As New SqlDataAdapter("select distinct year(meetingdate) as 'year' from meetings where meetingdate is not null " & _  
                "and idgroup = 7 order by year(meetingdate) desc", connect)  
        Dim councilMeetingAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim callToOrderTitleAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim citizenCommentsTitleAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim publicHearingsTitleAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim ConsentAgendaTitleAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim ordinancesTitleTableAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
 
 
 
        'Public Hearings Etc Section  
        Dim publicHearingsSubTitleAdapter As New SqlDataAdapter("select distinct contenttype.type, content.idcouncilmtgdate from [contenttype] inner join [content] on [content].idtype = contenttype.id where idcouncilmtgdate is not null and contenttype.type in ('Public Hearings','Presentations','Proclamations','Appointments')  and content.idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent)", connect)  
        Dim publicHearingsAdapter As New SqlDataAdapter("select content.description, contenttype.type,  content.id, url, content.idcouncilmtgdate from [contenttype] inner join [content] on [content].idtype = contenttype.id where idcouncilmtgdate is not null and contenttype.type in ('Public Hearings','Presentations','Proclamations','Appointments')  and idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent) order by content.orderindex", connect)  
        'End Public Hearing Etc Section  
 
        'Reports Section  
        Dim reportsTitleAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim reportsCommitteesAdapter As New SqlDataAdapter("select [group].groupname, meetingdate, meetings.id as 'idcouncilmtgdate', [group].id as 'idgroup' from [group], meetings where [group].idgrouptype = 4 and meetingdate is not null  and meetings.id = (select idcouncilmtgdate from agendapacketcurrent)", connect)  
        Dim reportsAgendaABAdapter As New SqlDataAdapter("SELECT AgendaBills.id, AgendaBills.ab_no, AgendaBills.idCouncilMtgDate, AgendaBills.idCommittee FROM AgendaBills INNER JOIN [Group] ON AgendaBills.idCommittee = [Group].id where [group].idgrouptype = 4 and agendabills.isordinance = 'no' and agendabills.isapproved = 'yes' and isconsentagenda = 'no'  and agendabills.idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent) order by AgendaBills.orderindex", connect)  
        Dim reportsDiscussionTitleAdapter As New SqlDataAdapter("SELECT distinct [type], idgroup, idcouncilmtgdate FROM ContentType INNER JOIN [Content] ON ContentType.id = [Content].idType where content.idtype = 4  and idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent)", connect)  
        Dim reportsDiscussionAdapter As New SqlDataAdapter("select [description], idgroup, [idcouncilmtgdate], [url], [content].[id] from [content] where content.idtype = 4  and idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent) order by content.orderindex", connect)  
 
        Dim staffReportsTitleAdapter As New SqlDataAdapter("select distinct contenttype.type, content.idcouncilmtgdate from [contenttype] inner join [content] on [content].idtype = contenttype.id where idcouncilmtgdate is not null and contenttype.type in ('Staff Reports')  and content.idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent)", connect)  
        Dim staffReportsAdapter As New SqlDataAdapter("select content.description, contenttype.type,  content.id, content.idcouncilmtgdate from [contenttype] inner join [content] on [content].idtype = contenttype.id where idcouncilmtgdate is not null and contenttype.type in ('Staff Reports')  and idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent) order by content.description", connect)  
        'End Reports Section  
 
        Dim otherApprovalsTitleAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim minutesTitleAdapter As New SqlDataAdapter("select idcouncilmtgdate, meetingdate from agendapacketcurrent inner join meetings on meetings.id = idcouncilmtgdate", connect)  
        Dim minutesAdapter As New SqlDataAdapter("select [description], [idcouncilmtgdate], [url], [content].[id] " & _  
            "from [content] " & _  
            "inner join " & _  
            "[contenttype] on [content].idtype = [contenttype].id " & _  
            "where [contenttype].[type] = 'Minutes' and idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent)" & _  
            "order by [orderindex]", connect)  
        Dim consentAgendaAdapter As New SqlDataAdapter("SELECT [ab_no], [title], [id], [idcouncilmtgdate] FROM [AgendaBills] WHERE (([isapproved] LIKE 'yes') AND ([isordinance] LIKE 'no') AND ([isConsentAgenda] LIKE 'yes'))  and agendabills.idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent) order by [orderindex]", connect)  
        Dim consentAgendaExhibitsTitleAdapter As New SqlDataAdapter("", connect)  
 
        Dim ordinancesCommitteesAdapter As New SqlDataAdapter("SELECT distinct [Group].groupname, [Group].id, AgendaBills.idCouncilMtgDate FROM [Group] INNER JOIN AgendaBills ON [Group].id = AgendaBills.idCommittee where [group].idgrouptype = 4 and agendabills.isordinance = 'yes' and agendabills.isapproved = 'yes' and agendabills.idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent)", connect)  
        Dim ordinancesCommitteesABAdapter As New SqlDataAdapter("SELECT AgendaBills.id, AgendaBills.ab_no, AgendaBills.idCouncilMtgDate, AgendaBills.idCommittee FROM AgendaBills INNER JOIN [Group] ON AgendaBills.idCommittee = [Group].id where [group].idgrouptype = 4 and agendabills.isordinance = 'yes' and agendabills.isapproved = 'yes' and agendabills.idcouncilmtgdate = (select idcouncilmtgdate from agendapacketcurrent)", connect)  
 
        'End SQL Queries  
 
        'Start Fill Tables  
        yearAdapter.Fill(yearTable)  
        councilMeetingAdapter.Fill(councilMeetingTable)  
        ConsentAgendaTitleAdapter.Fill(ConsentAgendaTitleTable)  
        otherApprovalsTitleAdapter.Fill(otherApprovalsTitleTable)  
        minutesTitleAdapter.Fill(minutesTitleTable)  
        minutesAdapter.Fill(minutesTable)  
        consentAgendaAdapter.Fill(consentAgendaTable)  
        callToOrderTitleAdapter.Fill(callToOrderTitleTable)  
        citizenCommentsTitleAdapter.Fill(citizenCommentsTitleTable)  
        publicHearingsTitleAdapter.Fill(publicHearingsTitleTable)  
        ordinancesTitleTableAdapter.Fill(ordinancesTitleTable)  
        reportsTitleAdapter.Fill(reportsTitleTable)  
        ordinancesCommitteesAdapter.Fill(ordinancesCommitteesTable)  
        ordinancesCommitteesABAdapter.Fill(ordinancesCommitteesABTable)  
        reportsCommitteesAdapter.Fill(reportsCommitteesTable)  
        reportsAgendaABAdapter.Fill(reportsAgendaABTable)  
        reportsDiscussionTitleAdapter.Fill(reportsDiscussionTitleTable)  
        reportsDiscussionAdapter.Fill(reportsDiscussionTable)  
        publicHearingsSubTitleAdapter.Fill(publicHearingsSubTitleTable)  
        publicHearingsAdapter.Fill(publicHearingsTable)  
        staffReportsTitleAdapter.Fill(staffReportsTitleTable)  
        staffReportsAdapter.Fill(staffReportsTable)  
 
 
        dsAgenda.Tables.Add(yearTable) '0  
        dsAgenda.Tables.Add(councilMeetingTable) '1  
        dsAgenda.Tables.Add(ConsentAgendaTitleTable) '2  
        dsAgenda.Tables.Add(otherApprovalsTitleTable) '3  
        dsAgenda.Tables.Add(minutesTitleTable) '4  
        dsAgenda.Tables.Add(minutesTable) '5  
        dsAgenda.Tables.Add(consentAgendaTable) '6  
        dsAgenda.Tables.Add(callToOrderTitleTable) '7  
        dsAgenda.Tables.Add(citizenCommentsTitleTable) '8  
        dsAgenda.Tables.Add(publicHearingsTitleTable) '9  
        dsAgenda.Tables.Add(ordinancesTitleTable) '10  
        dsAgenda.Tables.Add(reportsTitleTable) '11  
        dsAgenda.Tables.Add(ordinancesCommitteesTable) '12 should reference table 10 column id  
        dsAgenda.Tables.Add(ordinancesCommitteesABTable) '13 references table 12 id to idcommittee and idcouncilmtgdate to idcouncilmtgdate  
        dsAgenda.Tables.Add(reportsCommitteesTable) '14 should reference table 11 column id  
        dsAgenda.Tables.Add(reportsAgendaABTable) '15 references table 14  
        dsAgenda.Tables.Add(reportsDiscussionTitleTable) '16 references table 14  
        dsAgenda.Tables.Add(reportsDiscussionTable) '17 references table 16 idgroup, idcouncilmtgdate  
        dsAgenda.Tables.Add(publicHearingsSubTitleTable) '18 references table 9  
        dsAgenda.Tables.Add(publicHearingsTable) '19 references table 18  
        dsAgenda.Tables.Add(staffReportsTitleTable) '20 references table 11  
        dsAgenda.Tables.Add(staffReportsTable) '21 references table 20  
        'End Fill Tables  
 
        'Start All Relationships  
        'Start Add staffReportsTitle to staffReports Relation Columns  
        Dim parentstaffReportsTitleTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(20).Columns("type"), dsAgenda.Tables(20).Columns("idcouncilmtgdate")}  
        Dim childstaffReportsTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(21).Columns("type"), dsAgenda.Tables(21).Columns("idcouncilmtgdate")}  
 
        'End Start Add staffReportsTitle to staffReports Relation Columns  
 
        'Start Add PublicHearingsSubTitle to PublicHearings Relation Columns  
        Dim parentPublicHearingsSubTitleTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(18).Columns("type"), dsAgenda.Tables(18).Columns("idcouncilmtgdate")}  
        Dim childPublicHearingsTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(19).Columns("type"), dsAgenda.Tables(19).Columns("idcouncilmtgdate")}  
        'End Start Add PublicHearingsSubTitle to PublicHearings Relation Columns  
 
        'Start Add Ordinances Committees to Ordinances AB Relation Columns  
        Dim parentOrdinancesCommitteesTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(12).Columns("id"), dsAgenda.Tables(12).Columns("idcouncilmtgdate")}  
        Dim childordinancesCommitteesABTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(13).Columns("idcommittee"), dsAgenda.Tables(13).Columns("idcouncilmtgdate")}  
        'End Add Ordinances Committees to Ordinances AB Relation Columns  
 
        'Start Add Reports Committees to Reports AB Relation Columns  
        Dim parentReportsCommitteesTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(14).Columns("idgroup"), dsAgenda.Tables(14).Columns("idcouncilmtgdate")}  
        Dim childReportsCommitteesABTableColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(15).Columns("idcommittee"), dsAgenda.Tables(15).Columns("idcouncilmtgdate")}  
        'End Add Reports Committees to Reports AB Relation Columns  
 
        'Start Add Reports Committees to Discussion Title Columns  
        'References --> parentReportsCommitteesTableColumns <--  
        Dim childReportsDiscussionTitleColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(16).Columns("idgroup"), dsAgenda.Tables(16).Columns("idcouncilmtgdate")}  
        'End Start Add Reports Committees to Discussion Title Columns  
 
        'Start Add Discussion Title to Discussions   
        Dim parentReportsDiscussionTitleColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(16).Columns("idgroup"), dsAgenda.Tables(16).Columns("idcouncilmtgdate")}  
        Dim childReportsDiscussionColumns As DataColumn() = New DataColumn() {dsAgenda.Tables(17).Columns("idgroup"), dsAgenda.Tables(17).Columns("idcouncilmtgdate")}  
        'End Start Add Discussion Title to Discussions   
 
        'dsAgenda.Relations.Add("Year", dsAgenda.Tables(0).Columns("Year"), dsAgenda.Tables(1).Columns("Year"))  
        dsAgenda.Relations.Add("CouncilMeetingDate", dsAgenda.Tables(1).Columns("idcouncilmtgdate"), dsAgenda.Tables(2).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_CouncilMeeting_to_CallToOrder", dsAgenda.Tables(1).Columns("idcouncilmtgdate"), dsAgenda.Tables(7).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_CouncilMeeting_to_CitizenComments", dsAgenda.Tables(1).Columns("idcouncilmtgdate"), dsAgenda.Tables(8).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_CouncilMeeting_to_PublicHearings", dsAgenda.Tables(1).Columns("idcouncilmtgdate"), dsAgenda.Tables(9).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_CouncilMeeting_to_Ordinances", dsAgenda.Tables(1).Columns("idcouncilmtgdate"), dsAgenda.Tables(10).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_CouncilMeeting_to_Reports", dsAgenda.Tables(1).Columns("idcouncilmtgdate"), dsAgenda.Tables(11).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_Ordinances_to_OrdinancesCommittees", dsAgenda.Tables(10).Columns("idcouncilmtgdate"), dsAgenda.Tables(12).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_OrdinancesCommittees_to_OrdinancesCommitteesAB", parentOrdinancesCommitteesTableColumns, childordinancesCommitteesABTableColumns)  
        'dsAgenda.Relations.Add("rel_OrdinancesCommittees_to_OrdinancesCommitteesAB", dsAgenda.Tables(12).Columns("id"), dsAgenda.Tables(13).Columns("idcommittee"))  
        dsAgenda.Relations.Add("rel_consentAgendaTitle_to_otherApprovalsTitle", dsAgenda.Tables(2).Columns("idcouncilmtgdate"), dsAgenda.Tables(3).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_otherApprovals_to_consentAgenda", dsAgenda.Tables(3).Columns("idcouncilmtgdate"), dsAgenda.Tables(6).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_consentAgendaTitle_to_MinutesTitle", dsAgenda.Tables(2).Columns("idcouncilmtgdate"), dsAgenda.Tables(4).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_MinutesTitle_Minutes", dsAgenda.Tables(4).Columns("idcouncilmtgdate"), dsAgenda.Tables(5).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_Reports_To_ReportsCommittees", dsAgenda.Tables(11).Columns("idcouncilmtgdate"), dsAgenda.Tables(14).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_ReportsCommittees_To_ReportsCommitteesAB", parentReportsCommitteesTableColumns, childReportsCommitteesABTableColumns)  
        dsAgenda.Relations.Add("rel_ReportsCommittees_To_ReportsDiscussionTitle", parentReportsCommitteesTableColumns, childReportsDiscussionTitleColumns)  
        dsAgenda.Relations.Add("rel_ReportsDiscussionTitle_To_ReportsDiscussion", parentReportsDiscussionTitleColumns, childReportsDiscussionColumns)  
        dsAgenda.Relations.Add("rel_PublicHearings_To_PublicHearingsSubTitle", dsAgenda.Tables(9).Columns("idcouncilmtgdate"), dsAgenda.Tables(18).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_PublicHearingsSubTitle_To_PublicHearings", parentPublicHearingsSubTitleTableColumns, childPublicHearingsTableColumns)  
        dsAgenda.Relations.Add("rel_Reports_To_StaffReportsTitle", dsAgenda.Tables(11).Columns("idcouncilmtgdate"), dsAgenda.Tables(20).Columns("idcouncilmtgdate"))  
        dsAgenda.Relations.Add("rel_StaffReportsTitle_To_StaffReports", parentstaffReportsTitleTableColumns, childstaffReportsTableColumns)  
 
        'End All Relationships  
 
        For Each councilMeetingRow As DataRow In dsAgenda.Tables(1).Rows  
            Dim councilMeetingNode As New RadTreeNode(String.Format("{0:D}", councilMeetingRow(1)))  
            RadTreeView1.Nodes.Add(councilMeetingNode)  
            councilMeetingNode.ImageUrl = "~/images/logo_16x16.png" 
            councilMeetingNode.Value = councilMeetingRow(0).ToString()  
            councilMeetingNode.Attributes("idCouncilMtgdate") = Guid.NewGuid().ToString()  
            For Each callToOrderTitleRow As DataRow In councilMeetingRow.GetChildRows("rel_CouncilMeeting_to_CallToOrder")  
                Dim callToOrderTitleNode As New RadTreeNode(callToOrderTitleRow(0).ToString())  
                councilMeetingNode.Nodes.Add(callToOrderTitleNode)  
                callToOrderTitleNode.Text = "Call to Order" 
                callToOrderTitleNode.Font.Bold = True 
                callToOrderTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                callToOrderTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
            Next 
            For Each CitizenCommentsTitleRow As DataRow In councilMeetingRow.GetChildRows("rel_CouncilMeeting_to_CitizenComments")  
                Dim CitizenCommentsTitleNode As New RadTreeNode(CitizenCommentsTitleRow(0).ToString())  
                councilMeetingNode.Nodes.Add(CitizenCommentsTitleNode)  
                CitizenCommentsTitleNode.Text = "Citizen Comments" 
                CitizenCommentsTitleNode.Font.Bold = True 
                CitizenCommentsTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                CitizenCommentsTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
            Next 
            For Each PublicHearingsTitleRow As DataRow In councilMeetingRow.GetChildRows("rel_CouncilMeeting_to_PublicHearings")  
                Dim PublicHearingsTitleNode As New RadTreeNode(PublicHearingsTitleRow(0).ToString())  
                councilMeetingNode.Nodes.Add(PublicHearingsTitleNode)  
                PublicHearingsTitleNode.Text = "Public Hearings, Presentations, Proclamations, & Appointments" 
                PublicHearingsTitleNode.Font.Bold = True 
                PublicHearingsTitleNode.Style.Value = "white-space:normal" 
                PublicHearingsTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                PublicHearingsTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                PublicHearingsTitleNode.ContextMenuID = "cmPublicHearings" 
                For Each PublicHearingsSubTitleRow As DataRow In PublicHearingsTitleRow.GetChildRows("rel_PublicHearings_To_PublicHearingsSubTitle")  
                    Dim publicHearingsSubTitleNode As New RadTreeNode(PublicHearingsSubTitleRow(0).ToString())  
                    PublicHearingsTitleNode.Nodes.Add(publicHearingsSubTitleNode)  
                    publicHearingsSubTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                    publicHearingsSubTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                    For Each PublicHearingsRow As DataRow In PublicHearingsSubTitleRow.GetChildRows("rel_PublicHearingsSubTitle_To_PublicHearings")  
                        Dim PublicHearingsNode As New RadTreeNode(PublicHearingsRow(0).ToString())  
                        publicHearingsSubTitleNode.Nodes.Add(PublicHearingsNode)  
                        PublicHearingsNode.Attributes("idPublicHearing") = Guid.NewGuid().ToString()  
                        PublicHearingsNode.Value = PublicHearingsRow(2).ToString()  
 
                        If PublicHearingsRow(3).ToString = "" Then 
                            PublicHearingsNode.ImageUrl = "~/images/text_16x16.png" 
                            PublicHearingsNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                        Else 
                            'PublicHearingsNode.NavigateUrl  
                            'this means that there is a URL record  
 
 
                            PublicHearingsNode.NavigateUrl = "~/downloadfile.aspx?id=" & PublicHearingsNode.Value  
                            PublicHearingsNode.Target = "blank" 
                            PublicHearingsNode.ImageUrl = "~/images/pdf_16x16.png" 
                        End If 
                        'If (DirectCast((sender), RadTreeView)).ID = "RadTreeView1" Then  
                        'RadToolTipManager1.TargetControls.Add(PublicHearingsNode.Attributes("idPublicHearing"), PublicHearingsNode.Value, True)  
                        'End If  
 
                    Next 
                Next 
            Next 
            For Each consentAgendaTitleRow As DataRow In councilMeetingRow.GetChildRows("CouncilMeetingDate")  
                Dim consentAgendaTitleNode As New RadTreeNode(consentAgendaTitleRow(0).ToString())  
                councilMeetingNode.Nodes.Add(consentAgendaTitleNode)  
                consentAgendaTitleNode.Text = "Consent Agenda - Action Items" 
                consentAgendaTitleNode.Font.Bold = True 
                consentAgendaTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                consentAgendaTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                For Each minutesTitleRow As DataRow In consentAgendaTitleRow.GetChildRows("rel_consentAgendaTitle_to_MinutesTitle")  
                    Dim minutesTitleNode As New RadTreeNode(minutesTitleRow(0).ToString())  
                    consentAgendaTitleNode.Nodes.Add(minutesTitleNode)  
                    minutesTitleNode.Text = "Minutes" 
                    minutesTitleNode.Font.Italic = True 
                    minutesTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                    minutesTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                    minutesTitleNode.ContextMenuID = "cmMinutesWarrants" 
                    For Each minutesRow As DataRow In minutesTitleRow.GetChildRows("rel_MinutesTitle_Minutes")  
                        Dim minutesNode As New RadTreeNode(minutesRow(0).ToString())  
                        minutesTitleNode.Nodes.Add(minutesNode)  
                        minutesNode.ImageUrl = "~/images/minutes_16x16.png" 
                        minutesNode.Value = minutesRow(3).ToString()  
                        minutesNode.Attributes("id") = Guid.NewGuid().ToString()  
                        minutesNode.NavigateUrl = "~/downloadfile.aspx?id=" & minutesNode.Value  
                        minutesNode.Target = "blank" 
                        minutesNode.EnableContextMenu = False 
                    Next 
                Next 
                For Each otherApprovalsTitleRow As DataRow In consentAgendaTitleRow.GetChildRows("rel_consentAgendaTitle_to_otherApprovalsTitle")  
                    Dim otherApprovalsNode As New RadTreeNode(otherApprovalsTitleRow(0).ToString())  
                    consentAgendaTitleNode.Nodes.Add(otherApprovalsNode)  
                    otherApprovalsNode.Text = "Other Approvals" 
                    otherApprovalsNode.Font.Italic = True 
                    otherApprovalsNode.ImageUrl = "~/images/folderclose_16x16.png" 
                    otherApprovalsNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                    'otherApprovalsNode.EnableContextMenu = False  
                    otherApprovalsNode.ContextMenuID = "ConsentAgendaAdd" 
                    'Generate Consent Agendas  
                    For Each consentAgendaRow As DataRow In otherApprovalsTitleRow.GetChildRows("rel_otherApprovals_to_consentAgenda")  
                        Dim consentAgendaNode As New RadTreeNode(consentAgendaRow(0).ToString())  
                        otherApprovalsNode.Nodes.Add(consentAgendaNode)  
                        consentAgendaNode.Value = consentAgendaRow(2).ToString()  
                        consentAgendaNode.Attributes("id") = Guid.NewGuid().ToString()  
                        consentAgendaNode.ImageUrl = "~/images/agendabills_16x16.png" 
                        consentAgendaNode.EnableContextMenu = False 
                    Next 
                Next 
            Next 
            For Each OrdinancesTitleRow As DataRow In councilMeetingRow.GetChildRows("rel_CouncilMeeting_to_Ordinances")  
                Dim OrdinancesTitleNode As New RadTreeNode(OrdinancesTitleRow(0).ToString())  
                councilMeetingNode.Nodes.Add(OrdinancesTitleNode)  
                OrdinancesTitleNode.Text = "Ordinances" 
                OrdinancesTitleNode.Font.Bold = True 
                OrdinancesTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                OrdinancesTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                For Each ordinancesCommitteesRow As DataRow In OrdinancesTitleRow.GetChildRows("rel_Ordinances_to_OrdinancesCommittees")  
                    Dim ordinancesCommitteesNode As New RadTreeNode(ordinancesCommitteesRow(0).ToString())  
                    OrdinancesTitleNode.Nodes.Add(ordinancesCommitteesNode)  
                    ordinancesCommitteesNode.ImageUrl = "~/images/folderclose_16x16.png" 
                    ordinancesCommitteesNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                    ordinancesCommitteesNode.Font.Italic = True 
 
                    'rel_OrdinancesCommittees_to_OrdinancesCommitteesAB  
                    For Each OrdinancesCommitteesABRow As DataRow In ordinancesCommitteesRow.GetChildRows("rel_OrdinancesCommittees_to_OrdinancesCommitteesAB")  
                        Dim OrdinancesCommitteesABNode As New RadTreeNode(OrdinancesCommitteesABRow(1).ToString())  
                        ordinancesCommitteesNode.Nodes.Add(OrdinancesCommitteesABNode)  
                        OrdinancesCommitteesABNode.Value = OrdinancesCommitteesABRow(0).ToString()  
                        OrdinancesCommitteesABNode.Attributes("id") = Guid.NewGuid().ToString()  
                        OrdinancesCommitteesABNode.ImageUrl = "~/images/agendabills_16x16.png" 
                    Next 
                Next 
            Next 
            For Each ReportsTitleRow As DataRow In councilMeetingRow.GetChildRows("rel_CouncilMeeting_to_Reports")  
                Dim ReportsTitleNode As New RadTreeNode(ReportsTitleRow(0).ToString())  
                councilMeetingNode.Nodes.Add(ReportsTitleNode)  
                ReportsTitleNode.Text = "Reports" 
                ReportsTitleNode.Font.Bold = True 
                ReportsTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                ReportsTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                For Each reportsCommitteesRow As DataRow In ReportsTitleRow.GetChildRows("rel_Reports_To_ReportsCommittees")  
                    Dim reportsCommitteesNode As New RadTreeNode(reportsCommitteesRow(0).ToString())  
                    ReportsTitleNode.Nodes.Add(reportsCommitteesNode)  
                    reportsCommitteesNode.ImageUrl = "~/images/folderclose_16x16.png" 
                    reportsCommitteesNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                    reportsCommitteesNode.Font.Italic = True 
                    For Each ReportsCommitteesABRow As DataRow In reportsCommitteesRow.GetChildRows("rel_ReportsCommittees_To_ReportsCommitteesAB")  
                        Dim ReportsCommitteesABNode As New RadTreeNode(ReportsCommitteesABRow(1).ToString())  
                        reportsCommitteesNode.Nodes.Add(ReportsCommitteesABNode)  
                        ReportsCommitteesABNode.Value = ReportsCommitteesABRow(0).ToString()  
                        ReportsCommitteesABNode.Attributes("id") = Guid.NewGuid().ToString()  
                        ReportsCommitteesABNode.ImageUrl = "~/images/agendabills_16x16.png" 
                    Next 
                    For Each ReportsDiscussionTitleRow As DataRow In reportsCommitteesRow.GetChildRows("rel_ReportsCommittees_To_ReportsDiscussionTitle")  
                        Dim ReportsDiscussionTitleNode As New RadTreeNode(ReportsDiscussionTitleRow(0).ToString())  
                        reportsCommitteesNode.Nodes.Add(ReportsDiscussionTitleNode)  
                        ReportsDiscussionTitleNode.Value = ReportsDiscussionTitleRow(0).ToString()  
                        ReportsDiscussionTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                        ReportsDiscussionTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                        For Each ReportsDiscussionRow As DataRow In ReportsDiscussionTitleRow.GetChildRows("rel_ReportsDiscussionTitle_To_ReportsDiscussion")  
                            Dim ReportsDiscussionNode As New RadTreeNode(ReportsDiscussionRow(0).ToString())  
                            ReportsDiscussionTitleNode.Nodes.Add(ReportsDiscussionNode)  
 
                            If ReportsDiscussionRow(3).ToString = "" Then 
                                ReportsDiscussionNode.ImageUrl = "~/images/text_16x16.png" 
                                ReportsDiscussionNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                            Else 
                                'ReportsDiscussionNode.NavigateUrl  
                                'this means that there is a URL record  
                                ReportsDiscussionNode.Value = ReportsDiscussionRow(4).ToString()  
                                ReportsDiscussionNode.Attributes("id") = Guid.NewGuid().ToString()  
                                ReportsDiscussionNode.NavigateUrl = "~/downloadfile.aspx?id=" & ReportsDiscussionNode.Value  
                                ReportsDiscussionNode.Target = "blank" 
                                ReportsDiscussionNode.ImageUrl = "~/images/pdf_16x16.png" 
                            End If 
                        Next 
                    Next 
                Next 
                For Each staffReportsTitleRow As DataRow In ReportsTitleRow.GetChildRows("rel_Reports_To_StaffReportsTitle")  
                    Dim staffReportsTitleNode As New RadTreeNode(staffReportsTitleRow(0).ToString)  
                    ReportsTitleNode.Nodes.Add(staffReportsTitleNode)  
                    staffReportsTitleNode.ImageUrl = "~/images/folderclose_16x16.png" 
                    staffReportsTitleNode.ExpandedImageUrl = "~/images/folderselected_16x16.png" 
                    For Each staffReportsRow As DataRow In staffReportsTitleRow.GetChildRows("rel_StaffReportsTitle_To_StaffReports")  
                        Dim staffReportsNode As New RadTreeNode(staffReportsRow(0).ToString)  
                        staffReportsTitleNode.Nodes.Add(staffReportsNode)  
                        staffReportsNode.Value = staffReportsRow(2).ToString  
                        staffReportsNode.Attributes("id") = Guid.NewGuid().ToString()  
                        staffReportsNode.NavigateUrl = "~/downloadfile.aspx?id=" & staffReportsNode.Value  
                        staffReportsNode.Target = "blank" 
                        staffReportsNode.ImageUrl = "~/images/pdf_16x16.png" 
                    Next 
                Next 
            Next 
        Next 
 
    End Sub 
    Private Sub RadTreeView1_ContextMenuItemClick(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadTreeViewContextMenuEventArgs) Handles RadTreeView1.ContextMenuItemClick  
        Dim clickedNode As RadTreeNode = e.Node  
 
        Select Case e.MenuItem.Value  
            Case "AddPublicHearings" 
                'Response.Redirect("~/editors/addagendabill.aspx")  
                wdwInformation.Visible = True 
                Me.wdwInformation.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal  
                Me.wdwInformation.Modal = True 
                Me.wdwInformation.InitialLocation = Infragistics.Web.UI.LayoutControls.DialogWindowPosition.Centered  
                'Button1.Text = "You Clicked Add Public Hearings"  
                Exit Select 
            Case "AddConsentAB" 
                wdwInformation.Visible = True 
                Me.wdwInformation.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal  
                Me.wdwInformation.Modal = True 
                Me.wdwInformation.InitialLocation = Infragistics.Web.UI.LayoutControls.DialogWindowPosition.Centered  
                Exit Select 
            Case "AddProclamations" 
                Response.Redirect("http://www.yahoo.com")  
                Exit Select 
            Case "AddMinutes" 
                uContent.Visible = True 
                'RadTreeView1.DataBind()  
                'setValues()  
                RadTreeView1.DataSourceID = "" 
                Exit Select 
 
 
        End Select 
 
    End Sub 
    Private Sub setValues()  
        'uContent.idCouncilMeetingDate = RadComboBox1.SelectedValue  
 
        'Get id of ContentType  
        Dim connect_idType As New SqlConnection(ConfigurationManager.ConnectionStrings("CouncilAgendaConnectionString").ConnectionString)  
        connect_idType.Open()  
        Dim command_idType As New SqlCommand("select id from contenttype where type like 'Minutes'", connect_idType)  
        Dim idType As Int32  
        idType = command_idType.ExecuteScalar  
 
        'Set the idType to 'Staff Reports'  
        uContent.idType = idtype  
 
        'Set Departments as Group for dropdownlist  
        Dim connect_groupType As New SqlConnection(ConfigurationManager.ConnectionStrings("CouncilAgendaConnectionString").ConnectionString)  
        connect_groupType.Open()  
        Dim command_groupType As New SqlCommand("select id from grouptype where type like 'Staff Reports'", connect_groupType)  
        Dim groupType As Int32  
        groupType = command_groupType.ExecuteScalar  
 
        uContent.groupSelect = groupType  
 
        'Get Working Council Meeting Agenda ID  
        Dim connect_idCouncilMeetingDate As New SqlConnection(ConfigurationManager.ConnectionStrings("CouncilAgendaConnectionString").ConnectionString)  
        connect_idCouncilMeetingDate.Open()  
        Dim command_idCouncilMeetingDate As New SqlCommand("select idCouncilMtgDate from AgendaPacketCurrent", connect_idCouncilMeetingDate)  
        Dim idCouncilMeetingDate As Int32  
        idCouncilMeetingDate = command_idCouncilMeetingDate.ExecuteScalar  
        'Set ID of CouncilMeetingDate  
        uContent.idCouncilMeetingDate = "97" 
 
        'set GroupHeader Text  
        uContent.groupHeader = "Meeting Minutes" 
 
        'Enable error validation  
        uContent.rfvGroupEnabled = False 
        'uContent.rcUploadCOV = 8  
        'uContent.rcUploadCOV = 2  
        'uContent.rcUploadCOV = 1  
 
        uContent.lblDescriptionHeaderVisibility = False 
        uContent.reDescriptionVisibility = False 
 
    End Sub 



I have a context menu in the RadTreeView that when clicked, shows a user control that allows me to upload a file. The upload works well, but in order for the RadTreeView to show the new content of the database after the upload, I have to manually refresh the page.

I've tried setting the datasourceid of the the radtree to nothing then calling the BuildTree function again but that doesn't work either. Hopefully someone can provide a solution that I might be not seeing.

BTW, the ASPX page is below:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
 
        <telerik:RadTreeView ID="RadTreeView1" runat="server">  
            <ContextMenus> 
                <telerik:RadTreeViewContextMenu ID="ConsentAgendaAdd" runat="server">  
                    <Items> 
                        <telerik:RadMenuItem Value="AddConsentAB" Text="New Consent Agenda Bill" ImageUrl="~/images/menu/16x16/addagendabill.png">  
                        </telerik:RadMenuItem> 
                        <telerik:RadMenuItem Value="DelAB" Text="Delete Agenda Bill" ImageUrl="~/images/menu/16x16/addagendabill.png">  
                        </telerik:RadMenuItem> 
                        <telerik:RadMenuItem IsSeparator="true">  
                        </telerik:RadMenuItem> 
                    </Items> 
                    <CollapseAnimation Type="none" /> 
                </telerik:RadTreeViewContextMenu> 
                <telerik:RadTreeViewContextMenu ID="cmMinutesWarrants" runat="server">  
                    <Items> 
                        <telerik:RadMenuItem Value="AddMinutes" Text="New Minutes" ImageUrl="~/images/menu/16x16/addagendabill.png">  
                        </telerik:RadMenuItem> 
                        <telerik:RadMenuItem Value="AddWarrants" Text="New Warrants" ImageUrl="~/images/menu/16x16/addagendabill.png">  
                        </telerik:RadMenuItem> 
                    </Items> 
                    <CollapseAnimation Type="none" /> 
                </telerik:RadTreeViewContextMenu> 
                <telerik:RadTreeViewContextMenu ID="cmPublicHearings" runat="server">  
                    <Items> 
                        <telerik:RadMenuItem Value="AddPublicHearings" Text="New Public Hearing" PostBack="true">  
                        </telerik:RadMenuItem> 
                        <telerik:RadMenuItem Value="AddPresentations" Text="New Presentation">  
                        </telerik:RadMenuItem> 
                        <telerik:RadMenuItem Value="AddProclamations" Text="New Proclamation">  
                        </telerik:RadMenuItem> 
                        <telerik:RadMenuItem Value="AddAppointments" Text="New Appointment">  
                        </telerik:RadMenuItem> 
                    </Items> 
                    <CollapseAnimation Type="none" /> 
                </telerik:RadTreeViewContextMenu> 
            </ContextMenus> 
        </telerik:RadTreeView> 
 
      
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">  
    <asp:PlaceHolder ID="contentUpload" runat="server"></asp:PlaceHolder> 
    <asp:PlaceHolder ID="agendaBill" runat="server"></asp:PlaceHolder> 
    <uc1:Upload ID="uContent" runat="server" Visible="false" /> 
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="radtreeview1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="uContent" /> 
                    <telerik:AjaxUpdatedControl ControlID="Panel1" /> 
                      
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="uContent">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="pMainTree" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManagerProxy> 
</asp:Content> 
 

Thanks in advance!


PJ

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 24 Jun 2010, 12:03 PM
Hi PJ Rodriguez,

I am not sure, where exactly do you assign the handler of the OnClientContextMenuItemClicked event (there is no such assignment in the markup).

Also If you rebind the tree (which sounds like the best thing to do in this case), you probably should do it on:
- Page_Load time, if you are not adding controls in the nodes of the tree (this is your case as much I can see from the provided code);
- Page_Init time, if you are templating the nodes with additional controls in run-time (currently I don't think you do so).

Also you have to rebind the tree after the database is being updated, so the criteria in the Page_Load should be different. Either:
1. remove the "if" block and rebind the tree on every postback;
2. or persist a flag in the viewstate, stating if the tree should be reloaded or not (simple true/false should do). You will have to take care of updating this flag in the handler mentioned above (when you update the db) and in the createTree function (when you update the treeView).

Hope this is going to help you!


P.S.
Just a suggestion:
When you provide us with example project, could you try to send us something more simple, that only consists the relevant to the problem code, please? Or at least to be runnable (the code that you sent has Infragistic controls, db dependencies, user control etc. without which we are not able to run it) so we'll be able to debug it.
This is just a suggestion, but it would increase the chance of finding and resolving the problem that you experience if you decide to accept it.
Thanks!


Regards,
Nikolay Tsenkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
PJ Rodriguez
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or