Home All Groups Group Topic Archive Search About
Author
4 Apr 2005 1:31 PM
Micha B via .NET 247
Hello,

I'm trying to catch a mouse click on a Microsoft.Web.UI.WebControls.TreeView.
Is there a possibility to call a function when I click on a TreeNode?
If I use the SelectedIndexChanged nothing happens until I reload the website...
But thats not the thing I've in mind...

Thanks for help!
Micha

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>QdpA0DZ+dk67aEzQz8wDwg==</Id>

Author
5 Apr 2005 10:05 PM
lisa
Micha,

In order to pick up the SelectedIndexChanged event, you need to enable
AutoPostback.  The problem is, once you do that, it posts back every
time you expand or close a node.  There's no way to have it post back
on clicking and not on expanding/closing without modifying the control.

I don't know if third party controls are more friendly, and I don't
know if the TreeView control they're going to be shipping with ASP.NET
2.0 is going to be any better, either.

Lisa


Micha B via .NET 247 wrote:
> Hello,
>
> I'm trying to catch a mouse click on a
Microsoft.Web.UI.WebControls.TreeView.
Show quoteHide quote
> Is there a possibility to call a function when I click on a TreeNode?
> If I use the SelectedIndexChanged nothing happens until I reload the
website...
> But thats not the thing I've in mind...
>
> Thanks for help!
> Micha
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
>
> <Id>QdpA0DZ+dk67aEzQz8wDwg==</Id>
Author
6 Apr 2005 6:37 AM
Micha B
Hi,

is there some other opportunity to catch a mouseclick, made on this
treeview control?

Micha
Author
6 Apr 2005 11:30 AM
lisa
Micha B wrote:
> Hi,
>
> is there some other opportunity to catch a mouseclick, made on this
> treeview control?

You could try keeping autopostback off and adding a client side onclick
to the nodes that calls a javascript that posts back.  The only
question is how you'd fake the event arguments.  I've been meaning to
try that, but just haven't gotten around to it.

Lisa