473,851 Members | 2,297 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

working with TreeView, jscript/client side

Sorry folks but I will be reposting this question from 6/5 until someone
gives me an answer - the question is very easy and so ought the answer to
be. I really need the answer!

-------
I'm sorry for reposting but I've already googled for hours and I see others
have asked about this here without getting replies, this is starting to look
like some Bermuda phenomenon nobody wants to answer to! I really need to
accomplish the task below...

---
Is there any documentation out there to find out if and then how I can work
with TreeView on client side through jscript? For example I want to change
title of nodes and remove without doing postback. MS doesn't seem to have
any official documentation on this.

And please notice I'm not refering to IE TreeView control but asp.net 2.0's
TreeView!

Jun 8 '06 #1
1 2431
I may be able to help you out with this.

The biggest problem with the TreeNode is that you cannot retrieve the ID for
the node on the client side. The ID for the anchor tag that represents the
node is made up from the name of the containing control (sometimes prefixed
by the master page container control name), a "t", and a private index number
of the TreeNode.

You can get around this, but you end up limiting the current functionality
of the tree node.

To enable changing of the node text on the client side, create a new class
that inherits from the TreeNode. Override the RenderPreText method and add
the following code:

protected override void RenderPreText(H tmlTextWriter writer)
{
writer.WriteBeg inTag("a");
writer.WriteAtt ribute("id", "a" + this.ValuePath) ;
writer.Write("T his is the node text! Awesome!");
writer.Write(Ht mlTextWriter.Se lfClosingTagEnd );
base.RenderPreT ext(writer);
}
If you don't set the TreeNode.Text value, then this tag will be all the user
sees.
This puts an additional anchor tag in the treenode with an id (a +
node.ValuePath) that you can determine programatically at run time. In order
for the TreeView to use this (let's call it) AdvancedTreeNod e, you also have
to create a new AdvancedTreeVie w that extends the TreeView. Override the
CreateNode method that creates a new AdvancedTreeNod e and returns it
(implicitly cast to a TreeNode) thusly:

protected override TreeNode CreateNode()
{
return new AdvancedTreeNod e(this, false);
}

You can alter the AdvancedTreeNod e's new anchor tag so that it performs all
the required javascript calls via this new anchor tag. Use Lutz Roeder's
..NET Reflector to view the render method of the original TreeNode (or just
look at the DOM) to find out what javascript calls you should make when the
node is clicked on, etc.

To remove the node, you can just go up the family tree to the table that
contains both the new anchor tag and the old one and work your magic on that.
This method also allows you to scroll to a particular node -- just scroll to
the element with an ID of "a"+node.ValueP ath!

"Daves" wrote:
Sorry folks but I will be reposting this question from 6/5 until someone
gives me an answer - the question is very easy and so ought the answer to
be. I really need the answer!

-------
I'm sorry for reposting but I've already googled for hours and I see others
have asked about this here without getting replies, this is starting to look
like some Bermuda phenomenon nobody wants to answer to! I really need to
accomplish the task below...

---
Is there any documentation out there to find out if and then how I can work
with TreeView on client side through jscript? For example I want to change
title of nodes and remove without doing postback. MS doesn't seem to have
any official documentation on this.

And please notice I'm not refering to IE TreeView control but asp.net 2.0's
TreeView!

Jun 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9705
by: Mad Scientist Jr | last post by:
i am trying to set focus to a specific control depending on the outcome of a validator control and it is not working. none of these methods are working to setfocus: 1. RegisterStartupScript("sf","<scriptlanguage='javascript'>document.form.MyControlID.focus();</script>"); 2. Andy Smith's FirstFocus control from http://www.metabuilders.com/tools/FirstFocus.aspx
3
1594
by: Larry David | last post by:
Hi, I'm just trying to wrap my mind around the ASP.NET model. Let me walk you through a trivial scenario: Let's say I have a form containing a text box where the user enters his name. It also contains a button, labeled "Process Now!" My goal is to examine the user's name and upload it into a database. Since all of the elements (the form, the text box, and the button) have
7
3294
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with "registerClientScriptBlock" as follows: string script = "<script language=jscript>"; script += "function test()";
3
1511
by: Daves | last post by:
is there any documentation out there to find out if and then how I can work with TreeView on client side through jscript? For example I want to change title of nodes and remove without doing postback. MS doesn't seem to have any official documentation on this. And please notice I'm not refering to IE TreeView control but asp.net 2.0's TreeView!
0
1090
by: Daves | last post by:
I'm sorry for reposting but I've already googled for hours and I see others have asked about this here without getting replies, this is starting to look like some Bermuda phenomenon nobody wants to answer to! I really need to accomplish the task below... --- Is there any documentation out there to find out if and then how I can work with TreeView on client side through jscript? For example I want to change title of nodes and remove...
0
1156
by: Daves | last post by:
Sorry guys but I will be reposting this question from 6/5 until someone gives me an answer - the question is very easy and so ought the answer to be. I really need the answer! ------- I'm sorry for reposting but I've already googled for hours and I see others have asked about this here without getting replies, this is starting to look like some Bermuda phenomenon nobody wants to answer to! I really need to accomplish the task below...
1
3658
by: Victor Rodriguez | last post by:
Is there a way that I can have a client side event like oncontextmenu="showfunction();" on each node? thanks, Victor
8
12790
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if every time that a user selects a node, the whole page has to reload. Is there a way to have a node...
1
1663
by: sermet | last post by:
Hi everybody, I have an application that works for IE. I used treeview.htc to create a tree view. And I want my client side code to work with linux based operating systems. So the code should work on firefox or other gecko browsers. Sample code for IE is like the following: <HTML XMLNS:mytree > <HEAD><?IMPORT NAMESPACE="mytree" IMPLEMENTATION="./treeview.htc"/> <TITLE>Something</TITLE> </HEAD>
0
9895
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9744
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11011
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10670
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10725
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7900
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.