473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Expanding a treeview without postback

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
26 8460
"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
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
"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
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
"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
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
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
"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
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
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
"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
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
"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
"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
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
"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
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
"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
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
"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
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
"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
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
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ashfaq Gul via DotNetMonster.com | last post by:
Please help me.... i want to update record in datagrid without postback ....and the main thing that the confirmation of record updation should be from server not client ...because overwritting...
1
by: John Mason | last post by:
Hi, I am trying to figure out how to do a client-side calculation based on textbox values, using asp.net, without performing a postback. I have 2 textboxes... <asp:textbox runat="server"...
3
by: Daves | last post by:
is there anyway to use a TreeView without a Form runat="server" ? because having a TreeView in my masterpage requires me to add a Form there and then there is a conflict with the content page...
3
by: vinay | last post by:
Hi All I have a page in which i using user control .on user control i using javascript to pop up a message .when i choose wrong date in user control & submits the page it alerts the message of...
1
by: Tor Inge Rislaa | last post by:
I am using a DropDownList in my web page. I simply need to put the text of the selected index into a sql query, when the user click a save button. The problem is that the change of text in the...
2
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.