By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,918 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,918 IT Pros & Developers. It's quick & easy.

Expanding a treeview without postback

P: n/a
JJ
Is there any way you can expand a parent node on the treeview control
_without a postback_ by clicking on the node text (NOT clicking the expand
image URL) ?

I want to format the treeview node to look like a column of buttons that
expand to show the child nodes (if there are child nodes) qithout a
postback. I don't want to display the plus/minus or any other
expand/collapse graphic.

?

JJ
Mar 13 '07 #1
Share this Question
Share on Google+
26 Replies


P: n/a
"JJ" <ab*@xyz.comwrote in message
news:Ox**************@TK2MSFTNGP06.phx.gbl...
Is there any way you can expand a parent node on the treeview control
_without a postback_ by clicking on the node text (NOT clicking the expand
image URL) ?
Set the node's SelectAction property to TreeNodeSelectAction.Expand
http://www.google.co.uk/search?sourc...ction%2eExpand
Mar 13 '07 #2

P: n/a
JJ
Thanks Mark.

Do you also know if you can format the hover styles for the parent and child
nodes differently? There only seems to be one 'HoverNodeStyle' for the
entire treeview.

If I want the parents to look like buttons and the children to look like
something else, there is the
<LevelStylestag, but it doens't have anything but a fixed style for each
level as far as I can see (i.e. no HoverStyle for each level).

I guess I could try to format the node as its databound, depending on its
depth?

JJ.


"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:Ox**************@TK2MSFTNGP06.phx.gbl...
>Is there any way you can expand a parent node on the treeview control
_without a postback_ by clicking on the node text (NOT clicking the
expand image URL) ?

Set the node's SelectAction property to TreeNodeSelectAction.Expand
http://www.google.co.uk/search?sourc...ction%2eExpand

Mar 13 '07 #3

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:e5**************@TK2MSFTNGP05.phx.gbl...
Do you also know if you can format the hover styles for the parent and
child nodes differently?
Sorry - no idea...
I guess I could try to format the node as its databound, depending on its
depth?
That sounds like it should certainly work...
Mar 13 '07 #4

P: n/a
JJ
Without some pretty lengthy coding the treeview is proving a pain to format
for things like hovers, etc.

I think I'm going to look at the AJAX accordion control as another option
for a side menu. The idea I have is to use the Header panes for the Sub
Sections (the 'main' sections are in another menu). The content panes could
then have a repeater (for example) in there for and children that a Sub
Section may have.

The user would then click on the header and if there are any children, they
would be revealed below without a postback, if not, then the page is
refreshed with the required URL. In theory I hope I should have a lot more
flexibility over formatting than the Treeview or Menu control seems to
allow.

Sounds plausible?

Just downloading the latest AJAX Toolkit to try it out....

JJ
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:uv**************@TK2MSFTNGP02.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:e5**************@TK2MSFTNGP05.phx.gbl...
>Do you also know if you can format the hover styles for the parent and
child nodes differently?

Sorry - no idea...
>I guess I could try to format the node as its databound, depending on its
depth?

That sounds like it should certainly work...

Mar 14 '07 #5

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:eK**************@TK2MSFTNGP06.phx.gbl...
Without some pretty lengthy coding the treeview is proving a pain to
format for things like hovers, etc.
I have no problems whatever doing this, although I always build up TreeViews
in code...

I just create CSS entries as required and apply whichever one I need to the
individual nodes as I add them to the TreeView...
I think I'm going to look at the AJAX accordion control as another option
for a side menu. The idea I have is to use the Header panes for the Sub
Sections (the 'main' sections are in another menu). The content panes
could then have a repeater (for example) in there for and children that a
Sub Section may have.

The user would then click on the header and if there are any children,
they would be revealed below without a postback, if not, then the page is
refreshed with the required URL. In theory I hope I should have a lot more
flexibility over formatting than the Treeview or Menu control seems to
allow.

Sounds plausible?
Plausible certainly...

Sounds like you're using a sledgehammer to crack a nut, though...
Mar 14 '07 #6

P: n/a
JJ
But would this work for hover buttons?

I want to create a virtical menu of button-style links, that I can set to
'selected', and that change their look when the mouse hovers over them.

If the second level nodes look differerent to the first, and you can only
set a hover style for the entire tree, I can't see how this can be achieved?

JJ


"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:OD****************@TK2MSFTNGP05.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:eK**************@TK2MSFTNGP06.phx.gbl...
>Without some pretty lengthy coding the treeview is proving a pain to
format for things like hovers, etc.

I have no problems whatever doing this, although I always build up
TreeViews in code...

I just create CSS entries as required and apply whichever one I need to
the individual nodes as I add them to the TreeView...
>I think I'm going to look at the AJAX accordion control as another option
for a side menu. The idea I have is to use the Header panes for the Sub
Sections (the 'main' sections are in another menu). The content panes
could then have a repeater (for example) in there for and children that a
Sub Section may have.

The user would then click on the header and if there are any children,
they would be revealed below without a postback, if not, then the page is
refreshed with the required URL. In theory I hope I should have a lot
more flexibility over formatting than the Treeview or Menu control seems
to allow.

Sounds plausible?

Plausible certainly...

Sounds like you're using a sledgehammer to crack a nut, though...

Mar 14 '07 #7

P: n/a
JJ
Mark,

Any chance you could give me some hints/snippets how you build up the
databound treeview and apply the CSS styles?
Maybe I can work out of there is some way I can do this.

Thanks,

JJ
"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
But would this work for hover buttons?

I want to create a virtical menu of button-style links, that I can set to
'selected', and that change their look when the mouse hovers over them.

If the second level nodes look differerent to the first, and you can only
set a hover style for the entire tree, I can't see how this can be
achieved?

JJ


"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:OD****************@TK2MSFTNGP05.phx.gbl...
>"JJ" <ab*@xyz.comwrote in message
news:eK**************@TK2MSFTNGP06.phx.gbl...
>>Without some pretty lengthy coding the treeview is proving a pain to
format for things like hovers, etc.

I have no problems whatever doing this, although I always build up
TreeViews in code...

I just create CSS entries as required and apply whichever one I need to
the individual nodes as I add them to the TreeView...
>>I think I'm going to look at the AJAX accordion control as another
option for a side menu. The idea I have is to use the Header panes for
the Sub Sections (the 'main' sections are in another menu). The content
panes could then have a repeater (for example) in there for and children
that a Sub Section may have.

The user would then click on the header and if there are any children,
they would be revealed below without a postback, if not, then the page
is refreshed with the required URL. In theory I hope I should have a lot
more flexibility over formatting than the Treeview or Menu control seems
to allow.

Sounds plausible?

Plausible certainly...

Sounds like you're using a sledgehammer to crack a nut, though...


Mar 14 '07 #8

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
But would this work for hover buttons?
Obviously, a TreeView renders its nodes as hyperlinks, but it's a fairly
simple task to use CSS to make a hyperlink "look" like a button...
I want to create a virtical menu of button-style links, that I can set to
'selected', and that change their look when the mouse hovers over them.
OK.
If the second level nodes look differerent to the first, and you can only
set a hover style for the entire tree, I can't see how this can be
achieved?
But that's the whole point! I'm *not* setting a hover style for the entire
tree... As I said, "I just create CSS entries as required and apply
whichever one I need to the
individual nodes as I add them to the TreeView..."
Mar 14 '07 #9

P: n/a
JJ
Right. So what I think you're saying is:

1. Add the nodes one by one then set the CSS style of each level
2. Use CSS to set the hover, focus, on attributes.

Now I just how to work out how to set the CSS style of each node databound
node.

JJ

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:Om**************@TK2MSFTNGP02.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>But would this work for hover buttons?

Obviously, a TreeView renders its nodes as hyperlinks, but it's a fairly
simple task to use CSS to make a hyperlink "look" like a button...
>I want to create a virtical menu of button-style links, that I can set to
'selected', and that change their look when the mouse hovers over them.

OK.
>If the second level nodes look differerent to the first, and you can only
set a hover style for the entire tree, I can't see how this can be
achieved?

But that's the whole point! I'm *not* setting a hover style for the entire
tree... As I said, "I just create CSS entries as required and apply
whichever one I need to the
individual nodes as I add them to the TreeView..."

Mar 14 '07 #10

P: n/a
JJ
Right. So what I think you're saying is:

1. Add the nodes one by one then set the CSS style of each level
2. Use CSS to set the hover, focus, on attributes.

Now I just how to work out how to set the CSS style of each node databound
node.

JJ

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:Om**************@TK2MSFTNGP02.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>But would this work for hover buttons?

Obviously, a TreeView renders its nodes as hyperlinks, but it's a fairly
simple task to use CSS to make a hyperlink "look" like a button...
>I want to create a virtical menu of button-style links, that I can set to
'selected', and that change their look when the mouse hovers over them.

OK.
>If the second level nodes look differerent to the first, and you can only
set a hover style for the entire tree, I can't see how this can be
achieved?

But that's the whole point! I'm *not* setting a hover style for the entire
tree... As I said, "I just create CSS entries as required and apply
whichever one I need to the
individual nodes as I add them to the TreeView..."


Mar 14 '07 #11

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:ew**************@TK2MSFTNGP05.phx.gbl...
Any chance you could give me some hints/snippets how you build up the
databound treeview and apply the CSS styles?
I used this as a starting point:
http://fredrik.nsquared2.com/viewpost.aspx?PostID=299

And them modified it to my own needs...

The following article shows a similar modification:
http://forums.asp.net/1152605/ShowPost.aspx
Mar 14 '07 #12

P: n/a
JJ
Thanks very much. I will post back if/when I achieve what is clearly simple
but has got me totally going around in circles.

I'll postpone my first adventure with AJAX for now...

JJ

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:Od**************@TK2MSFTNGP02.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:ew**************@TK2MSFTNGP05.phx.gbl...
>Any chance you could give me some hints/snippets how you build up the
databound treeview and apply the CSS styles?

I used this as a starting point:
http://fredrik.nsquared2.com/viewpost.aspx?PostID=299

And them modified it to my own needs...

The following article shows a similar modification:
http://forums.asp.net/1152605/ShowPost.aspx

Mar 14 '07 #13

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:ef**************@TK2MSFTNGP05.phx.gbl...
1. Add the nodes one by one then set the CSS style of each level
Forget levels - set the style on a node by node basis... Chances are that
this will be tantamount to the same thing, but ignore LevelStyles
completely...
2. Use CSS to set the hover, focus, on attributes.
Correct.
Mar 14 '07 #14

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Thanks very much. I will post back if/when I achieve what is clearly
simple but has got me totally going around in circles.
It's only simple if you know how... :-) As I said, I didn't figure this out
for myself either - sometimes the key to being an efficient developer is
knowing how to use someone else's hard work... ;-)
I'll postpone my first adventure with AJAX for now...
Don't get me wrong - AJAX is superb technology, and would no doubt provide
you with your solution here...

However, for this particular issue, it's simply not necessary...
Mar 14 '07 #15

P: n/a
JJ
Mark,

Works like a dream.The RenderPreText and RenderPostText overrides make the
treeview formatting much more flexible.

I'll point anyone who comes across this thread with a similar issue to Marks
earlier link:
http://fredrik.nsquared2.com/viewpost.aspx?PostID=299

and additionally I found this one, for more examples:
http://weblogs.asp.net/dannychen/arc...25/436454.aspx

Mark, thanks (again) for saving me a great deal of time.

JJ
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:u5**************@TK2MSFTNGP06.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Thanks very much. I will post back if/when I achieve what is clearly
simple but has got me totally going around in circles.

It's only simple if you know how... :-) As I said, I didn't figure this
out for myself either - sometimes the key to being an efficient developer
is knowing how to use someone else's hard work... ;-)
>I'll postpone my first adventure with AJAX for now...

Don't get me wrong - AJAX is superb technology, and would no doubt provide
you with your solution here...

However, for this particular issue, it's simply not necessary...

Mar 14 '07 #16

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:el**************@TK2MSFTNGP05.phx.gbl...
Works like a dream
Hurrah!
Mark, thanks (again) for saving me a great deal of time.
No problem.
Mar 14 '07 #17

P: n/a
JJ
Mark, sorry to revisit this one, but....

Did you manage to change the selected CSS style of the treeviews selected
node without a postback?

JJ
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:O5**************@TK2MSFTNGP02.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:el**************@TK2MSFTNGP05.phx.gbl...
>Works like a dream

Hurrah!
>Mark, thanks (again) for saving me a great deal of time.

No problem.

Mar 16 '07 #18

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:ep**************@TK2MSFTNGP06.phx.gbl...
Mark, sorry to revisit this one, but....

Did you manage to change the selected CSS style of the treeviews selected
node without a postback?
??? I've never even tried that... As I said, I use the code I gave you to
add the nodes to the TreeView individually when the page loads, specifying
the style for each node as required - I'm not actually trying to change the
style of an individual node on the fly after the page has loaded...

Is that what you're trying to do...?
Mar 16 '07 #19

P: n/a
JJ
No - I think I worded that wrongly.

What I meant was this:

I've bound the tree to an XML datasource.
I don't want the page to refresh when the user clicks on any of the nodes
that have children (I just want the node to expand without a postback).
I was setting the css style of the node when the treeviews selected node was
changed (i.e. parsing through the nodes and if one is selected then settting
the CSS class). This would presumably cause a postback even if I have set
TreeNodeSelectedAction.Expand for each node so this is not the right way to
do it.

So, trying to achieve this via pure css, (and my CSS knowledge is not great
but ...) when a treenode is selected, does it's css class become
'.treeNodeCssClass.on'?
Or does is need to be '#treenodeId.on' ? ( - that can't be the right way as
I'd have to set up a CSS class for every node that could be selected based
on its ID wouldn't I?)

JJ

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:eT**************@TK2MSFTNGP05.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:ep**************@TK2MSFTNGP06.phx.gbl...
>Mark, sorry to revisit this one, but....

Did you manage to change the selected CSS style of the treeviews selected
node without a postback?

??? I've never even tried that... As I said, I use the code I gave you to
add the nodes to the TreeView individually when the page loads, specifying
the style for each node as required - I'm not actually trying to change
the style of an individual node on the fly after the page has loaded...

Is that what you're trying to do...?

Mar 16 '07 #20

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:e$**************@TK2MSFTNGP02.phx.gbl...
I've bound the tree to an XML datasource.
??? Why have you done that...??? The whole point of the way this works is
precisely *not* to populate the TreeView automatically by databinding...
Like I said, you need to add each node to the TreeView programatically. By
all means use an XML datasource if you like, but walk through its contents
in code, don't set it as the TreeView's datasource...
I don't want the page to refresh when the user clicks on any of the nodes
that have children (I just want the node to expand without a postback).
I was setting the css style of the node when the treeviews selected node
was changed (i.e. parsing through the nodes and if one is selected then
settting the CSS class). This would presumably cause a postback even if I
have set TreeNodeSelectedAction.Expand for each node so this is not the
right way to do it.
No. You only set TreeNodeSelectedAction.Expand for nodes which have
children. Obviously, you don't set a NavigateURL property for these nodes...
Then, when you click on these nodes, the <divthat has been created which
contains the hyperlinks for their child nodes is shown or hidden...
So, trying to achieve this via pure css, (and my CSS knowledge is not
great but ...) when a treenode is selected, does it's css class become
'.treeNodeCssClass.on'?
No, it doesn't.
Or does is need to be '#treenodeId.on' ? ( - that can't be the right way
as I'd have to set up a CSS class for every node that could be selected
based on its ID wouldn't I?)
Exactly! You need only as many CSS classes as there are different formatting
styles...
Mar 16 '07 #21

P: n/a
JJ
Right, so I need to add the nodes one by one.
I can then set the primary CSS class for each node, based on its depth.

Based on the CSS, I can then set '.treeNodeCssClass:hover' style in my css
sheet. But how do I do the selected node?
As I said, using the treenode Id in the css sheet is impractible, so.....
Is it '.treeNodeCssClass:focus'?

Or can you create some sort of new treenode type for each depth that has its
own distinct css style (i.e. not using :hover, etc in the css sheet, but
specifiying it in the c# code) for hover, select etc ?

I must be close....surely....?

JJ
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:e$**************@TK2MSFTNGP02.phx.gbl...
>I've bound the tree to an XML datasource.

??? Why have you done that...??? The whole point of the way this works is
precisely *not* to populate the TreeView automatically by databinding...
Like I said, you need to add each node to the TreeView programatically. By
all means use an XML datasource if you like, but walk through its contents
in code, don't set it as the TreeView's datasource...
>I don't want the page to refresh when the user clicks on any of the nodes
that have children (I just want the node to expand without a postback).
I was setting the css style of the node when the treeviews selected node
was changed (i.e. parsing through the nodes and if one is selected then
settting the CSS class). This would presumably cause a postback even if I
have set TreeNodeSelectedAction.Expand for each node so this is not the
right way to do it.

No. You only set TreeNodeSelectedAction.Expand for nodes which have
children. Obviously, you don't set a NavigateURL property for these
nodes... Then, when you click on these nodes, the <divthat has been
created which contains the hyperlinks for their child nodes is shown or
hidden...
>So, trying to achieve this via pure css, (and my CSS knowledge is not
great but ...) when a treenode is selected, does it's css class become
'.treeNodeCssClass.on'?

No, it doesn't.
>Or does is need to be '#treenodeId.on' ? ( - that can't be the right way
as I'd have to set up a CSS class for every node that could be selected
based on its ID wouldn't I?)

Exactly! You need only as many CSS classes as there are different
formatting styles...

Mar 16 '07 #22

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:Ou**************@TK2MSFTNGP03.phx.gbl...
Right, so I need to add the nodes one by one.
I can then set the primary CSS class for each node, based on its depth.
Absolutely correct.
Based on the CSS, I can then set '.treeNodeCssClass:hover' style in my css
sheet.
Correct again.
But how do I do the selected node?
I don't understand...
As I said, using the treenode Id in the css sheet is impractible, so.....
Is it '.treeNodeCssClass:focus'?
Again, I don't understand...
Or can you create some sort of new treenode type for each depth that has
its own distinct css style (i.e. not using :hover, etc in the css sheet,
but
specifiying it in the c# code) for hover, select etc ?
Once again, I'm not sure what you're getting at...

Try to take a bit of a step back here, and remember that TreeView nodes are
really nothing more than plain old hyperlinks... If you want a hyperlink to
look different when the mouse hovers over it, then you'd create a style
which did that - it's no different here...
I must be close....surely....?
Let's hope so... :-)
Mar 16 '07 #23

P: n/a
JJ
I still can't get it. I must be on the wrong path totally.

The parent nodes I am making look like buttons.
I can, but using my new treenode class set the css style to change the
button's appearance on hover.
However, (and I am not using the expand/collapse images) I want the button
to look different again when it's expanded (or selected).

If there's a postback I can achieve this by iterating through the nodes when
a selection/expansion takes place.
But without a postback, I assume I need to somehow find out how css styles
can be applied to a 'selected' node or an 'expanded' node without refering
to the node's id in the css sheet, and without using c# code to find the
selected node and set the style (which would cause a postback, presumably)
??

I know I can use the css psuedo classes :focus, :hover, :active to set the
nodes (buttons) to change their look (without postback).

Does that make sense or are we talking about completely different
approaches?

JJ


"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:Og**************@TK2MSFTNGP03.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:Ou**************@TK2MSFTNGP03.phx.gbl...
>Right, so I need to add the nodes one by one.
I can then set the primary CSS class for each node, based on its depth.

Absolutely correct.
>Based on the CSS, I can then set '.treeNodeCssClass:hover' style in my
css sheet.

Correct again.
>But how do I do the selected node?

I don't understand...
>As I said, using the treenode Id in the css sheet is impractible, so.....
Is it '.treeNodeCssClass:focus'?

Again, I don't understand...
>Or can you create some sort of new treenode type for each depth that has
its own distinct css style (i.e. not using :hover, etc in the css sheet,
but
specifiying it in the c# code) for hover, select etc ?

Once again, I'm not sure what you're getting at...

Try to take a bit of a step back here, and remember that TreeView nodes
are really nothing more than plain old hyperlinks... If you want a
hyperlink to look different when the mouse hovers over it, then you'd
create a style which did that - it's no different here...
>I must be close....surely....?

Let's hope so... :-)

Mar 16 '07 #24

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:eg**************@TK2MSFTNGP02.phx.gbl...
The parent nodes I am making look like buttons.
I can, but using my new treenode class set the css style to change the
button's appearance on hover.
However, (and I am not using the expand/collapse images) I want the button
to look different again when it's expanded (or selected).
Ah...right.
If there's a postback I can achieve this by iterating through the nodes
when a selection/expansion takes place.
But without a postback, I assume I need to somehow find out how css styles
can be applied to a 'selected' node or an 'expanded' node without refering
to the node's id in the css sheet, and without using c# code to find the
selected node and set the style (which would cause a postback, presumably)
Hmm - I've never tried that, but you *might* be able to add an "onclick"
attribute to those nodes with child nodes which would do this... Something
like:

objNode.Attributes.Add("onclick", "this.style='.....';");

However, I'm not sure if that would cancel the expanding and contracting of
the <divwith the child nodes...
Mar 16 '07 #25

P: n/a
JJ
Hi Mark (if you're still there ;-) )

Adding that attribute proved to be a bit of a problem, so I tried another
way, which I _think_ solves the problem:

I basically created a nested repeater, within a tag that had an ID that I
set. Using the repeater(s) item templates, I set out the repeater html like
a nested list. The repeater is databound.

I then used CSS to set the look of the outer repeater items (the 'parents')
and the inner items (the 'children') for both normal and hover events. The
tag which surrounded the children has its CSS attribute 'display' set to
none.

I then used simple javascript to set the onclick events for the parent to
change the CSS style of the tag surrounding the children to 'display=block'
and also to set the parent css style to one which represents its 'active'
state (and deactivate any others).

This approach gives me complete flexibility in the look of the 'nodes' and
so achieves (fingers firmaly crossed) my initial aims.
I would post code but I haven't quite finished it yet. Lets hope I'm not
speaking to soon....

JJ
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:O5**************@TK2MSFTNGP04.phx.gbl...
"JJ" <ab*@xyz.comwrote in message
news:eg**************@TK2MSFTNGP02.phx.gbl...
>The parent nodes I am making look like buttons.
I can, but using my new treenode class set the css style to change the
button's appearance on hover.
However, (and I am not using the expand/collapse images) I want the
button to look different again when it's expanded (or selected).

Ah...right.
>If there's a postback I can achieve this by iterating through the nodes
when a selection/expansion takes place.
But without a postback, I assume I need to somehow find out how css
styles can be applied to a 'selected' node or an 'expanded' node without
refering to the node's id in the css sheet, and without using c# code to
find the selected node and set the style (which would cause a postback,
presumably)

Hmm - I've never tried that, but you *might* be able to add an "onclick"
attribute to those nodes with child nodes which would do this... Something
like:

objNode.Attributes.Add("onclick", "this.style='.....';");

However, I'm not sure if that would cancel the expanding and contracting
of the <divwith the child nodes...

Mar 19 '07 #26

P: n/a
"JJ" <ab*@xyz.comwrote in message
news:ux*************@TK2MSFTNGP06.phx.gbl...
Hi Mark (if you're still there ;-) )
Hello...
This approach gives me complete flexibility in the look of the 'nodes' and
so achieves (fingers firmaly crossed) my initial aims.
Excellent! Glad you got it working...
Lets hope I'm not speaking to soon....
:-)
Mar 19 '07 #27

This discussion thread is closed

Replies have been disabled for this discussion.