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

  • Thread starter Thread starter George M.
  • Start date Start date
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!
 
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.
 
You do not need to edit the htc file. Try to use treeview client
behaviors. Refer MSDN for help.
 
Back
Top