469,610 Members | 1,762 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

Make treeview like datagrid

I want to display some drill-down data with a datagrid look. I can get the
exact functionality I want with a treeview, but I don't like the way the
treeview looks and formats the data. I want a multi-column table look like a
datagrid. It is not as easy as just hardcoding a datagrid within a datagrid
because the data may do down pretty deep. The treeview works great for this.
Is there a way to make the treeview look kind of like a datagrid or
something? Thanks.
Nov 28 '05 #1
5 2079
If the TV knows itemtemplates, than this is the magic word.
Add an item template and add a label control in that.
Set label text to"anything"
Then goto the 'html' source and modify this text propery for this label
with:

(From head:)
Text='<%#Eval("Fieldname1" ) & Eval("Fieldname2" ) %>'

Something like that.
This is just a start of course, you can swap the label for a table etc..

"lanem" <la***@discussions.microsoft.com> schreef in bericht
news:8B**********************************@microsof t.com...
I want to display some drill-down data with a datagrid look. I can get the
exact functionality I want with a treeview, but I don't like the way the
treeview looks and formats the data. I want a multi-column table look
like a
datagrid. It is not as easy as just hardcoding a datagrid within a
datagrid
because the data may do down pretty deep. The treeview works great for
this.
Is there a way to make the treeview look kind of like a datagrid or
something? Thanks.

Nov 28 '05 #2
Note, you should change Fieldname1 etc.. for the real fieldname.
I'm curious myself, will do a test tomorrow.
"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> schreef in bericht
news:dm**********@azure.qinip.net...
If the TV knows itemtemplates, than this is the magic word.
Add an item template and add a label control in that.
Set label text to"anything"
Then goto the 'html' source and modify this text propery for this label
with:

(From head:)
Text='<%#Eval("Fieldname1" ) & Eval("Fieldname2" ) %>'

Something like that.
This is just a start of course, you can swap the label for a table etc..

"lanem" <la***@discussions.microsoft.com> schreef in bericht
news:8B**********************************@microsof t.com...
I want to display some drill-down data with a datagrid look. I can get
the
exact functionality I want with a treeview, but I don't like the way the
treeview looks and formats the data. I want a multi-column table look
like a
datagrid. It is not as easy as just hardcoding a datagrid within a
datagrid
because the data may do down pretty deep. The treeview works great for
this.
Is there a way to make the treeview look kind of like a datagrid or
something? Thanks.


Nov 28 '05 #3
The Treeview does not have itemtemplates.

"Edwin Knoppert" wrote:
If the TV knows itemtemplates, than this is the magic word.
Add an item template and add a label control in that.
Set label text to"anything"
Then goto the 'html' source and modify this text propery for this label
with:

(From head:)
Text='<%#Eval("Fieldname1" ) & Eval("Fieldname2" ) %>'

Something like that.
This is just a start of course, you can swap the label for a table etc..

"lanem" <la***@discussions.microsoft.com> schreef in bericht
news:8B**********************************@microsof t.com...
I want to display some drill-down data with a datagrid look. I can get the
exact functionality I want with a treeview, but I don't like the way the
treeview looks and formats the data. I want a multi-column table look
like a
datagrid. It is not as easy as just hardcoding a datagrid within a
datagrid
because the data may do down pretty deep. The treeview works great for
this.
Is there a way to make the treeview look kind of like a datagrid or
something? Thanks.


Nov 28 '05 #4
Yes, i just noticed.
So i tried a different but more harder approach:

<%@ Page Language="VB" %>

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

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
End Sub

Protected Sub TreeView1_TreeNodePopulate(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.TreeNodeEventArgs)
e.Node.Text = Now & "<BR>" & Now.TimeOfDay.ToString
End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server"
OnTreeNodePopulate="TreeView1_TreeNodePopulate">
<Nodes>
<asp:TreeNode Text="New Node" Value="New Node">
<asp:TreeNode Value="New Node" PopulateOnDemand="true"
</asp:TreeNode> </asp:TreeNode>
</Nodes>
</asp:TreeView>
&nbsp;</div>
</form>
</body>
</html>

Maybe you can dump a table look-alike in during each node's event?
Let me know, i'm curious about this.

Edwin,
"lanem" <la***@discussions.microsoft.com> schreef in bericht
news:56**********************************@microsof t.com... The Treeview does not have itemtemplates.

"Edwin Knoppert" wrote:
If the TV knows itemtemplates, than this is the magic word.
Add an item template and add a label control in that.
Set label text to"anything"
Then goto the 'html' source and modify this text propery for this label
with:

(From head:)
Text='<%#Eval("Fieldname1" ) & Eval("Fieldname2" ) %>'

Something like that.
This is just a start of course, you can swap the label for a table etc..

"lanem" <la***@discussions.microsoft.com> schreef in bericht
news:8B**********************************@microsof t.com...
>I want to display some drill-down data with a datagrid look. I can get
>the
> exact functionality I want with a treeview, but I don't like the way
> the
> treeview looks and formats the data. I want a multi-column table look
> like a
> datagrid. It is not as easy as just hardcoding a datagrid within a
> datagrid
> because the data may do down pretty deep. The treeview works great for
> this.
> Is there a way to make the treeview look kind of like a datagrid or
> something? Thanks.


Nov 28 '05 #5
This exactly fits your description:

http://www.componentart.com/demos/tr.../WebForm1.aspx

If your time is worth anything, then paying for this full-featured treeview
might be "worth" it's cost.

-HTH

"lanem" <la***@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.com...
I want to display some drill-down data with a datagrid look. I can get the
exact functionality I want with a treeview, but I don't like the way the
treeview looks and formats the data. I want a multi-column table look
like a
datagrid. It is not as easy as just hardcoding a datagrid within a
datagrid
because the data may do down pretty deep. The treeview works great for
this.
Is there a way to make the treeview look kind of like a datagrid or
something? Thanks.

Nov 28 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Banda RamaNarsi Reddy | last post: by
reply views Thread by Marco Martin | last post: by
1 post views Thread by Grey | last post: by
2 posts views Thread by Sandy | last post: by
7 posts views Thread by vsiat | last post: by
3 posts views Thread by Shawn | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.