Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 501313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:10:36+00:00 2026-05-13T06:10:36+00:00

I found the problem with PopulateOnDemand with my treview class derived from System.Web.UI TreeView.

  • 0

I found the problem with PopulateOnDemand with my treview class derived from System.Web.UI TreeView.

I made my

 public class ParishTV : System.Web.UI.WebControls.TreeView

and also my TreeNode

public class ParishTVNode : TreeNode
{
    public DateTime LastLoaded;

    public ParishTVNode():base()
    {

    }
    public ParishTVNode(string text, string value, string ImageURL, string navigateURL, string target): base(text, value, ImageURL, navigateURL, target)
    {
        LastLoaded = DateTime.Now;
    }
    public ParishTVNode(string s)
        : base(s)
    {
        LastLoaded = DateTime.Now;
    }
}

I assemble em in standalone dll and include in my project.
Also I downloaded adapters in source codes from http://www.asp.net/CSSAdapters/
added there adapter for ParishTV.

I registered

<%@ Register TagPrefix="Pari" Namespace="ParishNS" Assembly="ParishTV" %>

and create tree

I fill tree within OnInit eventhandler from DB.

Ah, also I made record for attaching adapter to my tree class:

  <adapter controlType="System.Web.UI.WebControls.TreeView" adapterType="CSSFriendly.TreeViewAdapter" />
  <adapter controlType="ParishNS.ParishTV"  adapterType="CSSFriendly.ParishTVAdapter" />

Well, everything works fine When I do Not use populate on demand.

First problem occurs when I realised that OnInit in faired each time I click on node and tree is rebuild from scratch. okey, I removed OnInit and populate Tree with some nodes from aspx file useing

        <Nodes>
            <Pari:ParishTVNode Text="Inventory1" Value="1"  Expanded ="false" SelectAction="Expand" PopulateOnDemand="true" />
            <Pari:ParishTVNode Text="Inventory2" Value="2" Expanded ="false" SelectAction="Expand" PopulateOnDemand="true" />
            <Pari:ParishTVNode Text="Inventory3" Value="3" Expanded ="false" SelectAction="Expand"  PopulateOnDemand="true" />
        </Nodes>

When OnPopulate occurs I create MY ParishTVNode:

    TreeNode child = null;
    switch (e.Node.Value)
    {
        case "1":
            child = new ParishTVNode("Classical");
            e.Node.ChildNodes.Add(child);

            child = new ParishTVNode("Rock");

            e.Node.ChildNodes.Add(child);

…

It works! but only once. when one node is populated it is ok, but then depending not on what node is populated somehow are created nodes with Correct text and correct values, but Not of My parishTVNode type but of Base TreeNode class ^^.

All new nodes from second OnPopulate firing are TreeNodes but not ParishTVNodes.

I create ParisTVNodes, and at the end of OnPopulate eventhandler they are ParishTVNodes, but when Adapter is trying to render em, first nodes are ParishTVNodes and these bad nodes are TreeNodes.

Help, please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:10:37+00:00Added an answer on May 13, 2026 at 6:10 am

    You need to override the CreateNode method. On postback, the TreeView has to reconstruct the tree from the viewstate. This method allows treeview extenders to use their own TreeNode types without experiencing the issue you’re dealing with.

    Its pretty simple to do…

    override TreeNode CreateNode()
    {
      return new ParishTVNode();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 303k
  • Answers 303k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You'll have to use XPath for that. $nodes = $myXML->xpath('//*[@id="hi"]');… May 13, 2026 at 8:38 pm
  • Editorial Team
    Editorial Team added an answer typeof(MyClass).GetInterfaces() will return all interfaces implemented by the class. From… May 13, 2026 at 8:38 pm
  • Editorial Team
    Editorial Team added an answer As mentioned in this thread Have you listed the org.eclipse.core.runtime… May 13, 2026 at 8:38 pm

Related Questions

I've been using NVelocity as a stand-alone templating engine in my text file generator.
The situation is like this : Main project A. and a class library B.
I'm trying to load a texture with RGBA values but the alpha values just
I am monitoring a folder with a .net filewatcher for certain kind of files(*.mbxml).
Hello I'm looking for a way to search for a word in a word

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.