Treeview click events - whole row instead of just the caption?

H

Homer J. Simpson

It seems that treeviews require the user to click on a node's caption (or
icon) in order to generate a postback. I'd like to be able to click
anywhere on the row (eg, hook up the event to the encapsulating <tr> tag).
How would I go about that--since the treeview doesn't give you access to its
HTML elements directly?
 
G

Guest

Hi,
I think the only way how to achieve this is to write custom adapter for
TreeView. If you want to do this way you can start from CssFriendlyAdapters
and modify only part of TreeView affecting your functionality.

I konw this task is possible only for GridView where you can handle
RowDataBound event and add onclick attribute to row. But this is possible
only because row has attributes (HTML attributes) collection. TreeNode does
not offer this collection so thats the reason why I think you will not
achieve this task without rewriting tree view rendering.

Regards,
Ladislav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top