C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




treeview control


Posted Date: 28 Aug 2008      Total Responses: 1

Posted By: Saritha Reddy       Member Level: Silver     Points: 1


in treeview control how can i get the checked parent node child text using vb.net





Responses

Author: Appukuttan    28 Aug 2008Member Level: DiamondRating:     Points: 6
Hi..


1 <asp:TreeView ID="TreeView1" runat="server" ShowLines="True">
2 <Nodes>
3 <asp:TreeNode SelectAction="Expand" Text="Operating System"
4 Value="Operating System">
5 <asp:TreeNode ImageUrl="~/unchecked.GIF" Text="Windows XP SP1"
6 Value="Windows XP SP1"></asp:TreeNode>
7 <asp:TreeNode ImageUrl="~/unchecked.GIF" Text="Windows XP SP2"
8 Value="Windows XP SP2"></asp:TreeNode>
9 <asp:TreeNode ImageUrl="~/unchecked.GIF" Text="Windows 2003"
10 Value="Windows 2003"></asp:TreeNode>
11 <asp:TreeNode ImageUrl="~/unchecked.GIF" Text="Windows Vista"
12 Value="Windows Vista"></asp:TreeNode>
13 </asp:TreeNode>
14 <asp:TreeNode SelectAction="Expand" Text="Application" Value="Application">
15 <asp:TreeNode ImageUrl="~/unchecked.GIF" Text="Office XP" Value="Office XP">
16 </asp:TreeNode>
17 <asp:TreeNode ImageUrl="~/unchecked.GIF" Text="Office 2003" Value="Office 2003">
18 </asp:TreeNode>
19 <asp:TreeNode ImageUrl="~/unchecked.GIF" Text="Office 2007" Value="Office 2007">
20 </asp:TreeNode>
21 </asp:TreeNode>
22 </Nodes>
23 </asp:TreeView>
24 <br />
25 <asp:Label ID="Label1" runat="server"></asp:Label>
26 <br />
27 <asp:Button ID="Button1" runat="server" Text="Click here to Check the item(s) you choose" />



1 Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.SelectedNodeChanged
2 Dim mynode As TreeNode = TreeView1.SelectedNode
3 For i As Integer = 0 To myNode.Parent.ChildNodes.Count - 1
4 myNode.Parent.ChildNodes(i).ImageUrl = "~/unchecked.gif"
5 myNode.Parent.ChildNodes(i).Checked = False
6 Next
7 myNode.ImageUrl = "~/checked.gif"
8 myNode.Checked = True
9 End Sub
10
11 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
12 Label1.Text = "Here are the item(s) you choose"
13 For i As Integer = 0 To TreeView1.CheckedNodes.Count - 1
14 Label1.Text = Label1.Text & ", " & TreeView1.CheckedNodes(i).Text
15 Next
16 End Sub



Post Reply
You must Sign In to post a response.
Next : in an upload control
Previous : How to start VC++
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use