473,320 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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.
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 3672
JamieHowarth0
533 Expert 512MB
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 Expert 512MB
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.
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
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:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChang ed">
<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:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="TreeView1"
PopupControlID="Panel1">
</cc1:ModalPopupExtender>
<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
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 misunderstanding the forum topic.
Sorry for made you unconvinced.
Oct 26 '07 #5
vanc
211 Expert 100+
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:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChang ed">
<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:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="TreeView1"
PopupControlID="Panel1">
</cc1:ModalPopupExtender>
<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 Expert 1GB
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
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.Text = this.TreeView1.SelectedNode.Value.ToString();

I wish it will need not to refresh the page.
Can this is possible?
Thank you for replying.
Oct 26 '07 #8
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
I just find a solution here. Following is my codes.

Default.aspx
[HTML] <asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChang ed">
<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:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button1"
PopupControlID="Panel1">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px" Style="display: none;">
&nbsp;<asp:TreeView ID="TreeView2" runat="server" OnSelectedNodeChanged="TreeView2_SelectedNodeChang ed">
</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
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...
4
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...
3
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...
3
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...
1
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...
1
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....
0
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....
1
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...
8
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.