??? - No Postback When Clicking on Folder in Treeview

G

George M.

I'm working with the treeview control on an ASP.NET page (written in C#), and I have one built the looks something like:

Root
|_Category1
|_Site1
|_Report1
|_Report2
|_Site2
|_Report3
|_Report4
|_Category2
|_Site1
|_Report5
|_Report6
|_Site2
|_Report7
|_Report8

(etc., etc. - note there could be any number of Category, Site, and Report nodes; the treeview is built from a database table)

In my application, I only want a postback to fire if the user clicks on a Report node. I want nothing to happen if they click on the Root node or any Category or Site nodes (i.e., I don't want a postback or anything else).

Through C# code-behind I've been able to "short-circuit" if the user clicks on a node that's node a Report node by checking the type of the node and if it's not of type "Report" then do nothing. But, this still needs a postback to check the node type and everything else.

So, since I'm not JavaScript expert, I thought I'd post this message to see if anyone knew how to edit the treeview.htc file so that only clicking the Report nodes actually fired a postback and whatever else it does. Any one know how to do this? Any other suggestions?

TIA!
 
J

jm

I'm working with the treeview control on an ASP.NET page (written in C#), and I have one built the looks something like:

Root
|_Category1
|_Site1
|_Report1
|_Report2
|_Site2
|_Report3
|_Report4
|_Category2
|_Site1
|_Report5
|_Report6
|_Site2
|_Report7
|_Report8

(etc., etc. - note there could be any number of Category, Site, and Report nodes; the treeview is built from a database table)

In my application, I only want a postback to fire if the user clicks on a Report node. I want nothing to happen if they click on the Root node or any Category or Site nodes (i.e., I don't want a postback or anything else).

Through C# code-behind I've been able to "short-circuit" if the user clicks on a node that's node a Report node by checking the type of the node and if it's not of type "Report" then do nothing. But, this still needs a postback to check the node type and everything else.

So, since I'm not JavaScript expert, I thought I'd post this message to see if anyone knew how to edit the treeview.htc file so that only clicking the Report nodes actually fired a postback and whatever else it does. Any one know how to do this? Any other suggestions?

TIA!

Why does it postback at all? Just curious. Mine does not do this.
 
R

Ram

You do not need to edit the htc file. Try to use treeview client
behaviors. Refer MSDN for help.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top