473,782 Members | 2,396 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pop up different text base on the selected TreeNode?

50 New Member
How to pop up different text base on the selected TreeNode?
I want to pop up different Text base on the selected TreeNode of the TreeView component. So, I create a TreeView and a ModalPopupExten der. Following is my codes.
Expand|Select|Wrap|Line Numbers
  1.         <asp:ScriptManager ID="ScriptManager1" runat="server">
  2.         </asp:ScriptManager>
  3.         <asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
  4.             <Nodes>
  5.                 <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
  6.                 <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
  7.             </Nodes>
  8.         </asp:TreeView>
  9.         <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="TreeView1"
  10.             PopupControlID="Panel1">
  11.         </cc1:ModalPopupExtender>
  12.         <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
  13.             <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></asp:Panel>
  14.  
When I click the TreeView component, the panel is pop up, but the text of label in the panel is not change. Does anyone know why, and how to solve this problem?
Oct 25 '07 #1
9 3712
JamieHowarth0
533 Recognized Expert Contributor
Hi vincent,

This questions belongs in the .NET Forum as per the "sticky" note at the top of this forum - this particular forum is for "classic" ASP questions.

medicineworker
Oct 25 '07 #2
nateraaaa
663 Recognized Expert Contributor
How to pop up different text base on the selected TreeNode?
I want to pop up different Text base on the selected TreeNode of the TreeView component. So, I create a TreeView and a ModalPopupExten der. Following is my codes.
Expand|Select|Wrap|Line Numbers
  1.         <asp:ScriptManager ID="ScriptManager1" runat="server">
  2.         </asp:ScriptManager>
  3.         <asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
  4.             <Nodes>
  5.                 <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
  6.                 <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
  7.             </Nodes>
  8.         </asp:TreeView>
  9.         <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="TreeView1"
  10.             PopupControlID="Panel1">
  11.         </cc1:ModalPopupExtender>
  12.         <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
  13.             <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></asp:Panel>
  14.  
When I click the TreeView component, the panel is pop up, but the text of label in the panel is not change. Does anyone know why, and how to solve this problem?
Do you change the text of the label in the code behind?

Nathan
Oct 25 '07 #3
vincent90152900
50 New Member
Do you change the text of the label in the code behind?

Nathan
I am sorry to forget to post the c# codes. Here is my codes.

Default.aspx.cs
Expand|Select|Wrap|Line Numbers
  1. protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
  2. {
  3.    this.Label1.Text = this.TreeView1.SelectedNode.Value.ToString();
  4. }
Default.aspx
[HTML]
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeC hanged="TreeVie w1_SelectedNode Changed">
<Nodes>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
</Nodes>
</asp:TreeView>
<cc1:ModalPopup Extender ID="ModalPopupE xtender1" runat="server" TargetControlID ="TreeView1"
PopupControlID= "Panel1">
</cc1:ModalPopupE xtender>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
&nbsp;
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></asp:Panel>
[/HTML]
Oct 26 '07 #4
vincent90152900
50 New Member
Hi vincent,

This questions belongs in the .NET Forum as per the "sticky" note at the top of this forum - this particular forum is for "classic" ASP questions.

medicineworker
I am sorry for misunderstandin g the forum topic.
Sorry for made you unconvinced.
Oct 26 '07 #5
vanc
211 Recognized Expert New Member
I am sorry to forget to post the c# codes. Here is my codes.

Default.aspx.cs
Expand|Select|Wrap|Line Numbers
  1. protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
  2. {
  3.    this.Label1.Text = this.TreeView1.SelectedNode.Value.ToString();
  4. }
Default.aspx
[HTML]
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeC hanged="TreeVie w1_SelectedNode Changed">
<Nodes>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode>
</Nodes>
</asp:TreeView>
<cc1:ModalPopup Extender ID="ModalPopupE xtender1" runat="server" TargetControlID ="TreeView1"
PopupControlID= "Panel1">
</cc1:ModalPopupE xtender>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
&nbsp;
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></asp:Panel>
[/HTML]
What do you mean not change? "New Node" --> "New Node" or Label1 x-> "New Node" :D, have you refreshed your page?

cheers.
Oct 26 '07 #6
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
After you click the tree node...you would see the text as label1

When you click on another node, you should see the labels text set to the previous noce you had clicked.

Which clearly means that you will have to refresh the page!! ..or unless you set the text of the label in the panel using javascript
Oct 26 '07 #7
vincent90152900
50 New Member
What do you mean not change? "New Node" --> "New Node" or Label1 x-> "New Node" :D, have you refreshed your page?

cheers.
I want to change the Text property like following.

this.Label1.Tex t = this.TreeView1. SelectedNode.Va lue.ToString();

I wish it will need not to refresh the page.
Can this is possible?
Thank you for replying.
Oct 26 '07 #8
vincent90152900
50 New Member
After you click the tree node...you would see the text as label1

When you click on another node, you should see the labels text set to the previous noce you had clicked.

Which clearly means that you will have to refresh the page!! ..or unless you set the text of the label in the panel using javascript
I see.
Thank you for replying.
Oct 26 '07 #9
vincent90152900
50 New Member
I just find a solution here. Following is my codes.

Default.aspx
[HTML] <asp:ScriptMana ger ID="ScriptManag er1" runat="server" />
<asp:UpdatePane l ID="UpdatePanel 1" runat="server" UpdateMode="Con ditional">
<ContentTemplat e>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeC hanged="TreeVie w1_SelectedNode Changed">
<Nodes>
<asp:TreeNode Text="01" Value="01"></asp:TreeNode>
<asp:TreeNode Text="02" Value="02"></asp:TreeNode>
<asp:TreeNode Text="03" Value="03"></asp:TreeNode>
</Nodes>
</asp:TreeView>
<asp:Button ID="Button1" runat="server" Text="Button" Style="display: none" />
<cc1:ModalPopup Extender ID="ModalPopupE xtender1" runat="server" TargetControlID ="Button1"
PopupControlID= "Panel1">
</cc1:ModalPopupE xtender>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px" Style="display: none;">
&nbsp;<asp:Tree View ID="TreeView2" runat="server" OnSelectedNodeC hanged="TreeVie w2_SelectedNode Changed">
</asp:TreeView>
<asp:Button ID="Button2" runat="server" Text="Button" Style="display: none" /></asp:Panel>
</ContentTemplate >
</asp:UpdatePanel >[/HTML]

Default.aspx.cs
Expand|Select|Wrap|Line Numbers
  1.         protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
  2.         {
  3.             TreeNode treeNode = new TreeNode();
  4.             treeNode.Text = this.TreeView1.SelectedNode.Value.ToString();
  5.             this.TreeView2.Nodes.Add(treeNode);
  6.             this.UpdatePanel1.Update();
  7.             this.ModalPopupExtender1.Show();
  8.         }
  9.  
  10.         protected void TreeView2_SelectedNodeChanged(object sender, EventArgs e)
  11.         {
  12.             this.ModalPopupExtender1.Hide();
  13.         }
Oct 26 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4466
by: Jon Davis | last post by:
Seems that there's a bug in the TreeNode object. When you change the font, it does not readjust its size appropriately. The following code shows the boldface text truncated with everything after "W" removed. private void Form1_Load(object sender, System.EventArgs e) { TreeNode newNode = new TreeNode("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); treeView1.Nodes.Add(newNode); newNode = new TreeNode("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
4
2591
by: Peter Wagner | last post by:
Hi There are 2 different .NET Programs A und B. I'll drag a TreeNode from a TreeView in A into a ListView in B. In B I'll extract values from the dropped TreeNode. Unfortunately I don't know how to extract the values. :-( Code in B -------------- private void ListView_DragDrop(object sender,
3
7622
by: Manish Jain | last post by:
Platform: C# Windows Application/Framework 1.1 ---------------------------------------------------- I am implementing Drag' Drop between 2 trees. Now when I initiate drag and "DragOver" the other tree, I want the nodes on which I move my mouse to get selected to show where I am going to drop. I am able to get the TreeNode using mouse coordinates, and when I say node.TreeView.SelectedNode = node; then I get all the relevent events etc.
3
3318
by: Philip Wagenaar | last post by:
How can I check if any child of a node is selected. If the node itself is selected I want false, if any other node or it's child's are selected I want false, but if any child of a specific node is selected I want true returned ..
1
9983
by: James L | last post by:
Hi, I have a treeview that has to be refreshed due to data changes. Is it possible to select the last node that they were viewing when the tree view was been populated once again? I have tried getting the selected node and then expanding it in the refreshed tree view using expand() but it does not do it. Thanks for any help.
1
4102
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS. The Web Services are explained as follows: IMPORT WEB SERVICE:
0
940
by: vincent90152900 | last post by:
How to pop up different text base on the selected TreeNode? I want to pop up different Text base on the selected TreeNode of the TreeView component. So, I create a TreeView and a ModalPopupExtender. Following is my codes. Default.aspx <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged"> ...
1
9903
by: JR | last post by:
Hi, I need a routine/finction that finds a text, starting at the selected node, where a given text is in. say i have some nodes with 1 'sonday' and another with 'son' and I look for 'so' it will first find 'sonday' and the next time 'son'. ones it have found everything with the look parameter it restart at the top. Jan
8
2641
by: slizorn | last post by:
Hi guys, I have this coding that I wanted to try out. Basically this is meant to be done in Java as practice for the Topic trees in data structures and algorithms. I have recently learned C++ on my own so I wanted to test my skill in C++ by tryin to solve this problem using C++. so yea here it goes... i have a text file as follows... H,E,L E,B,F
0
9480
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
10313
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
10146
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
10080
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
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.