473,473 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Tree View

5 New Member
Is it possible to show the Treeview in a list box
Dec 15 '07 #1
3 848
harshadd
176 New Member
A list box can have multiple coloumns But yiu ca not use it as a tree, why you want a list box when tree is available? Both are designed for diff purpose...

rgds
Harshad Dandekar
Dec 16 '07 #2
jakki
5 New Member
Tank you.. for your reply..
Dec 20 '07 #3
jakki
5 New Member
i want to populate a data from a data base..

i wrote a code for webapplication aspx.cs.. which is perfectly work's
code is

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
PopulateRootLevel();
}
}
//select ParentId, GroupName,(select count(*) FROM tree WHERE SubGroup=sc.ParentId) SubGroup,SubGroup FROM tree sc where ParentId=@parentID
private void PopulateRootLevel()
{
SqlConnection objConn = new SqlConnection("Data Source=CDTECHPRO2\\SQLEXPRESS;Initial Catalog=Image;Integrated Security=True");
SqlCommand objCommand = new SqlCommand("select ParentId,GroupName,(select count(*) FROM tree WHERE SubGroup=sc.ParentId) childnodecount FROM tree sc where SubGroup IS NULL", objConn);
SqlDataAdapter da = new SqlDataAdapter(objCommand);
DataTable dt = new DataTable();
da.Fill(dt);
PopulateNodes(dt, TreeView1.Nodes);
}

private void PopulateNodes(DataTable dt, TreeNodeCollection nodes)
{
foreach (DataRow dr in dt.Rows)
{
TreeNode tn = new TreeNode();
tn.Text = dr["GroupName"].ToString();
tn.Value = dr["ParentId"].ToString();
nodes.Add(tn);
//If node has child nodes, then enable on-demand populating
tn.PopulateOnDemand = ((int)dr["childnodecount"] > 0);
}
}

private void PopulateSubLevel(int parentid, TreeNode parentNode)
{
SqlConnection objConn = new SqlConnection("Data Source=CDTECHPRO2\\SQLEXPRESS;Initial Catalog=Image;Integrated Security=True");
SqlCommand objCommand = new SqlCommand("select ParentId,GroupName,(select count(*) FROM tree " + "WHERE SubGroup=sc.ParentId) childnodecount FROM tree sc where SubGroup=@SubGroup", objConn);
objCommand.Parameters.Add("@SubGroup", SqlDbType.Int).Value = parentid;
SqlDataAdapter da = new SqlDataAdapter(objCommand);
DataTable dt = new DataTable();
da.Fill(dt);
PopulateNodes(dt, parentNode.ChildNodes);
}

protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
int s = int.Parse(e.Node.Value);
PopulateSubLevel(s, e.Node);
}




but it should not work in C# windows application...


PopulateOnDemand insted of what method what method i am going to use to dinamically populate a data... and this event is also not alaliable..

protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
Dec 27 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: imani_technology_spam | last post by:
We need to present hierarchical data on a web page, the same way the tree view shows files in Windows Explorer. Here's the catch: that tree view needs to be bound to a SQL Server database. How...
0
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i...
1
by: Jesper DK | last post by:
Hi, I have docked a tree view to the left on a form. When I start to populate this tree view with nodes, a horizontal scroll box appears in the bottom of the tree view even though thee tree...
3
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an...
1
by: Kaye | last post by:
It seems that when I dynamically resize items in a tree-view control, using TVM_SETITEM and the TVITEMEX iIntegral member, things go awry. The window draws properly, but it seems like the RECTs for...
10
by: dwok | last post by:
Does anyone know of a good article that discusses creating a "Tree View" control in ASP.NET? Or perhaps a Tree View Control that comes with source code? I have come across a lot of tree controls...
0
by: rinishrk | last post by:
Hi, I have a web application that contains subfolders Admin and User with related webpages inside them. Within the Admin folder I have a page containing a Tree View Control.I want this tree view...
3
by: gmail | last post by:
Hi Friends, Can any body suggest me on this. I am working on .NET 2005 Frame work 2.0 . I am facing problem using the tree stucture. I created the site map.Now i want use the site map in every...
1
by: BeginingOfLife | last post by:
i am using a java script to create a tree view in my html page. i got that script from this link : http://destroydrop.com/javascripts/tree/ given script is static script creations for tree...
1
by: happy.john1234 | last post by:
Hi, i have got large xml file which i have to show in tree view windows form.I tried with loading all those data at once to tree view but it took a long time to render that tree view.Now i am...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.