TreeView + SelectedNodeChanged + UpdatePanel = Problems

Last post 06-12-2007 3:26 PM by karamchandb. 5 replies.

Sort Posts:

  • TreeView + SelectedNodeChanged + UpdatePanel = Problems

    10-24-2006, 1:55 PM
    • Loading...
    • mblodgett
    • Joined on 10-24-2006, 3:50 PM
    • Posts 2

    I wondered if anyone else has had strange behavior when specifying the SelectedNodeChanged event of a TreeView as an AsyncPostBackTrigger for an UpdatePanel.  I'm currently seeing erratic behavior.  Some nodes will post back when selected, and others won't; it seems totally random.

    There was no problem before I upgraded from Release 60914 of the toolkit.
     

  • Re: TreeView + SelectedNodeChanged + UpdatePanel = Problems

    11-01-2006, 5:29 PM
    While we work closely with the ASP.NET AJAX team when developing the Toolkit, they're the real experts on general ASP.NET AJAX issues. Your problem doesn't seem to be directly related to the Toolkit, so we'd appreciate if you considered posting to one of the other newsgroups such as AJAX Discussion and Suggestions. Your post will be more helpful to others looking for similar advice if it's in the right place. Thank you!
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: TreeView + SelectedNodeChanged + UpdatePanel = Problems

    01-22-2007, 1:45 PM
    • Loading...
    • rahulmanasa
    • Joined on 01-22-2007, 5:53 PM
    • Posts 5

    I have Treeview inside asp:UpdatePanel. {ASP.NET Ajax RC version}

    Its not maintaining its viewstate properly while expanding/collepsing nodes.

    If I remove Updatepanel,, it works fine.

     Is it a bug ?? what could be relevent and reliable solution.

     Thanks in advance.

     Rahul Jain

    KY

    Filed under:
  • Re: TreeView + SelectedNodeChanged + UpdatePanel = Problems

    01-22-2007, 8:00 PM
    • Loading...
    • Steve Marx
    • Joined on 05-26-2006, 8:35 PM
    • Microsoft
    • Posts 643
    This is still the wrong forum for this question, but I'll answer anyway: TreeView is not supported inside an UpdatePanel.  See http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx.
    Steve Marx | ASP.NET AJAX Evangelist | Microsoft Corporation
  • Re: TreeView + SelectedNodeChanged + UpdatePanel = Problems

    04-17-2007, 11:08 PM
    • Loading...
    • vince.n3t
    • Joined on 04-17-2007, 11:20 PM
    • Posts 2

    If you have a TreeView inside an UpdatePanel, it is better to have the following properties set as such PopulateNodesFromClient="false" and EnableClientScript="false". Hope this will solve at least some random problems when clicking/expanding/collapsing a treenode.

    Cheers,

    vince.n3t
     

  • Re: TreeView + SelectedNodeChanged + UpdatePanel = Problems

    06-12-2007, 3:26 PM

    Hello,

     I tried a few things in my code & everything started working fine. But I get an error on the IE7 page (error: Invalid argument, Line: 43, Character:238).

    On putting a break point & then debugging, I get a break on the JS page & the error points to ----->  accordion.insertBefore(wrapper, content) 

    I have no idea what this error means & how to debug it. Because everything on the IE7 page works as I want it to, but I get this error on the status bar as: 'Done, but with errors on page'.

     

    Please help me with this error, as this a project I am working on & I need to complete it before the deadline. Any other options for creating a TreeView using any of the Ajax Extenders with the Update Panel are also welcome. 

     My Default.aspx :

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AJAXRajeev.Default" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">   
        <title>
            Sales Professional Desktop II
        </title>
    </head>
        <body>
           <form id="form1" method="post" runat="server">         
            <div class="Default" style="float:left">
                &nbsp; &nbsp;&nbsp;&nbsp;
                <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true">
                    <Services>
                        <asp:ServiceReference Path="WebService.asmx" />
                    </Services>       
                </asp:ScriptManager>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">       
                       <ContentTemplate>
                       <div id="MyAccordion" runat="server">
                            <ajaxToolkit:Accordion ID="Accordion1" runat="server" SelectedIndex="0">
                                        <Panes>
                                            <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
                                                <Header><a href="" onclick="return false;" class="accordionlink" />
                                                    External Documents
                                                </Header>
                                                <Content>
                                                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">       
                                                      <ContentTemplate>
                                                      <asp:Panel ID="navPanel" runat="server" ScrollBars="auto">
                                                        <asp:TreeView ID="TreeView1" runat="server" BackColor="Transparent" ExpandDepth="1" MaxDataBindDepth="2" NodeIndent="10" SkipLinkText="skip nav" Target="~/Default.aspx" ToolTip="navigation" Font-Names="Verdana" Font-Size="Smaller" ForeColor="Gray" ShowLines="True" PopulateNodesFromClient="true" EnableClientScript="True">
                                                            <ParentNodeStyle Font-Bold="False" ImageUrl="~/Images/folder.gif" />
                                                            <HoverNodeStyle Font-Underline="True" />
                                                            <SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px" ImageUrl="~/Images/folder_open.gif" />
                                                            <RootNodeStyle ImageUrl="~/Images/folder.gif" />
                                                            <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" ImageUrl="~/Images/folder_open.gif" />                          
                                                        </asp:TreeView>
                                                       </asp:Panel>
                                                       </ContentTemplate>
                                                     </asp:UpdatePanel>
                                                         <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                                                           <ProgressTemplate>
                                                               External Documents               
                                                           </ProgressTemplate>   
                                                         </asp:UpdateProgress>
                                                 </Content>
                                             </ajaxToolkit:AccordionPane>
                                          </Panes>
                              </ajaxToolkit:Accordion>
                             </div>
                          </ContentTemplate>
                    </asp:UpdatePanel>                          
                    <asp:UpdateProgress ID="UpdateProgress2" runat="server">
                           <ProgressTemplate>
                               External Documents               
                           </ProgressTemplate>                                                    
                    </asp:UpdateProgress>
            </div>     
          </form>
        </body>
    </html>

     

    My Default.aspx.cs :

     using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using AllianceBernstein.Wsg.Retail.Common.Data;
    using System.Data.SqlClient;
    using System.IO;
    using System.Drawing;
    using System.Web.Services;
    using AjaxControlToolkit;

    namespace AJAXRajeev
    {
        [Serializable]
        public partial class Default : System.Web.UI.Page
        {
            protected System.Web.UI.WebControls.Label lblSelectedPath;
            protected const string ROOT_PATH = "2:";

            protected TreeView Tree
            {
                get
                {
                    return Accordion1.FindControl("TreeView1") as TreeView;
                }
            }

            protected UpdatePanel UpdatePanel
            {
                get
                {
                    return Accordion1.FindControl("UpdatePanel1") as UpdatePanel;
                }
            }

            protected void Page_Load(object sender, System.EventArgs e)
            {
                //UpdateProgress1.AssociatedUpdatePanelID = this.UpdatePanel.ClientID;
               
                Ajax.Utility.RegisterTypeForAjax(typeof(AJAXPortal));
                if (!Page.IsPostBack)
                {
                    LoadTree();
                }

                Folder[] aFolders = Folder.List();

                this.Tree.ExpandAll();
            }

            [Ajax.AjaxMethod()]
            private void LoadTree()
            {
                if (this.Tree == null)
                {
                    return;
                }

                Folder[] aFolders = Folder.List();
                foreach (Folder oFolder in aFolders)
                {
                    TreeNode oTreeNode = new TreeNode();
                    oTreeNode.Text = oFolder.Name;
                    oTreeNode.ImageUrl = "/images/folder.gif";
                    this.Tree.Nodes.Add(oTreeNode);

                }
            }

            internal DataSet ListFolder()
            {
                throw new Exception("The method or operation is not implemented.");
            }

           
        }
    }

     

    Please help me with this.

    Karamchand

Page 1 of 1 (6 items)
Microsoft Communities
Page view counter