TreeView Problem

Last post 04-22-2009 1:22 AM by om_prakashp. 1 replies.

Sort Posts:

  • TreeView Problem

    04-21-2009, 4:06 PM
    • Member
      38 point Member
    • Frozzare
    • Member since 08-23-2007, 7:28 PM
    • Sweden
    • Posts 152

     Hello. When i click the + button in my treeview i get this error with css adapter:

     

            private void PopulatePages(TreeNode node)
            {
                SqlCommand sqlQuery = new SqlCommand("Select Pageid, Parentid, Pagetitle from ss_page where parentid = " + node.Value.ToString());
                DataSet resultSet;
                resultSet = RunQuery(sqlQuery);
                if (resultSet.Tables.Count > 0)
                {
                    foreach (DataRow row in resultSet.Tables[0].Rows)
                    {
                        TreeNode NewNode = new TreeNode(row["PageTitle"].ToString(), row["pageid"].ToString());
                        NewNode.PopulateOnDemand = true;
    
                        NewNode.NavigateUrl = "/./templates/StandardPage.aspx?id=" + row["pageid"].ToString();
                        NewNode.SelectAction = TreeNodeSelectAction.SelectExpand;
                        node.ChildNodes.Add(NewNode);
                    }
    
                }
            }
     

    Index was outside the bounds of the array.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [IndexOutOfRangeException: Index was outside the bounds of the array.]
    CSSFriendly.TreeViewAdapter.ExpandToState(TreeNodeCollection nodes, String state) +346
    CSSFriendly.TreeViewAdapter.OnLoad(EventArgs e) +91
    System.Web.UI.Control.LoadRecursive() +8679693
    System.Web.UI.Control.LoadRecursive() +141
    System.Web.UI.Control.LoadRecursive() +141
    System.Web.UI.Control.LoadRecursive() +141
    System.Web.UI.Control.LoadRecursive() +141
    System.Web.UI.Control.LoadRecursive() +141
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
  • Re: TreeView Problem

    04-22-2009, 1:22 AM
    Answer
    • Contributor
      2,142 point Contributor
    • om_prakashp
    • Member since 03-09-2009, 2:50 AM
    • Posts 312
Page 1 of 1 (2 items)