.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Show selected node attributes

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net

I have a treeview for which I will bind the data from XML to build the tree view. My sample XML file looks like this?

<Sites name="" title="">

 <site id="1" name="a"></site>

<site id="2" name="b"></site>





Now when I bind this XML file to tree view, I need to show the attributes of selected node. For example, if I expand Sites node, I will have several child nodes with site as name. Now when I select the first site node, I need to show its attributes (id=1,name = a) and when I select second site, I need to show its attributes(id=2, name=b) ...

In short, I need to extract the selected node attributes only.

How can i achieve this?

Please reply ASAP.

View Complete Post

More Related Resource Links

Modify Menu adapter to show selected


Hey, I need some help modifying the menu adapter code to give child <ul> elements a class value indicating that the parent is selected. It should render like this:


< ul class="AspNet-Menu">
	< li class="AspNet-Menu-WithChildren  AspNet-Menu-ChildSelected">
		< a href="/rockit/admin/Default.aspx" class="AspNet-Menu-Link  AspNet-Menu-ChildSelected">
		< span>Mypage< /span>< /a>
			< ul class="AspNet-Sub AspNet-Sub-Selected">
				< li class="AspNet-Menu-Leaf  AspNet-Menu-Selected">
					< a href="/rockit/admin/Default2.aspx" class="AspNet-Menu-Link  AspNet-Menu-Selected">
					< span>Test< /span>< /a>
				< /li>
				< li class="AspNet-Menu-Leaf">
					< a href="/rockit/Default3.aspx" class="AspN

How to handle treeview selected node changed event



From my below sample code, I don't want to use Sessions to handle each click event inside treeview selected node changed.

Secondly, if you suggest me to use treenode.SelectedValue then I would say my values are dyanmically generated.

Everytime a node a clicked, the selected node value is sent in the next request xml to get response and xml schema is different for each click. How do I handle this each click event other than using session variables. I thought of using Request.Item (and integrating with URL redirect property) but I don't want to use that.


Dim trNode As New TreeNode
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then        
            trNode.Text = "Not Postback"
            Session("Flag") = 1
        End If
    End Sub

Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.SelectedNodeChanged
        If Session.Item("Flag") = 1 Then
            trNode.Text = "Is PostBack"
            Session("Flag") = 2
        End If

Switch selected members of two attributes with identically named members



I have two attributes (A and B) which have the exact same set of members.
I have a measure giving me a value for the relationship (A,B).

In a calculated measure, I would like to automatically calculate the value for (B,A) (which is not the same as (A,B)).

I was thinking of doing the following in the calculated measure:
1. Get the selected members of attribute A.
2. Perform SetToStr on the set of selected members.
3. Replace the name of attribute A by the name of attribute B.
4. Perform StrToMember.
5. Do steps 1-4 for attribute B.
6. Retrieve the value.

Unfortunately I have no idea how to perform a string replacement with MDX.

Am I missing something?


jquery jstree and dynatree parent node don't get selected(asp.net mvc)


I have used jquery jstree and dynatree persistance example using check boxes and found the same logic The thing is that the if for example there is a parent and 4 child. a) i select all the 4 child (parent get auto selected) the 4 child and the parent node id get posted to the controller. b) But if i select less then 4 children (parent get auto selected) only child node ids get posted to the controller. Is there any way even if i select less then 4 children all my selected nodes included the parent get posted to the controller?

i wrote a method to conquor this but if i can do it in conventional way . it would be great. i hope some one has experience this problem and can help me out?

Custom attributes in AD does not show in Property Mapping for Synchronization


Hi, I have problem with the Profile Synchronization in SharePoint 2010.

I have made a connection to our Active Directory and the Synchronization of profiles is working like a charm but when I try to map User Properties to attributes in our AD I can't see the custom attributes we made in the AD. The attributes are added to the AD after the initial connection and synchronization was made. 

Any ideas what I'm doing wrong?




treeview selected node font style does not change


Hi All,

I have a treeview and I am giving the node style in code behind.

Treeview design is as below:

<asp:TreeView ID="tvIARHierarchies" runat="server" NodeIndent="15" ShowExpandCollapse="true"
                                        ShowLines="True" Width="98%" OnSelectedNodeChanged="tvIARHierarchies_SelectedNodeChanged">
                                        <ParentNodeStyle Font-Bold="False" />
                                        <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />

Determine node type selected in TreeView and reading property values


I am hoping that someone can help me get past some problems I am having when using the WPF TreeView control.  I have a TreeView that at most can have 3 levels.  The levels are defined as Project, Discipline, Person which would look like the following:

+ Project

    + Discipline

        - Person

My TreeView is bound to a database using two HierarchicalDataTemplate's and then one DataTemplate (the binding is done in the XAML).

What I would like to get is the following information when selecting an item:

  1. Read the selected value (text of the selected node)
  2. show selected date in calendar


    Hi all,

    I've got this terrible brain freeze today ;-)

    I have an asp:Calendar (not ajax). When I set the selectedDate from codebehind to a date in another month, I'd want the new selected date to show (that is, show the calendar "page" with the new month. How do I do this?

    calFromDate.SelectedDate = myDate 'works fine

    calFromDate.ShowSelectedDate's Month 'pseudocode


    The calendar resides in an updatepanel for speed purposes, but I don't think that has anything to do with anything...


    Thanks a lot!


how to find selected Table value and show using alert


<table cellpadding="0" cellspacing="0" style="border-width:0;">
				<td><div style="width:20px;height:1px;">

				</div></td><td><a href="javascript:TreeView_ToggleExpand ('Tr_NewTarget','0_7','IT','','','')"><img alt="Collapse Info Tech" id="Tr_NewTarget_0_7_img" src="/WebResource.axd?d=3e2216c966e53b58ad98c5b69cfb6c1fbaab3bde2736d21b&t=634205864100000000" style="border-width:0;" /></a></td><td onmouseout="TreeView_UnhoverNode(this)" onmouseover="TreeView_HoverNode('Tr_NewTarget', this)" style="white-space:nowrap;"><a id="Tr_NewTarget_0_7_txt" class="Tr_NewTarget_0" href="javascript:__doPostBack('Tr_NewTarget','sel|0_7')">Info Tech</a></td>
		</table><span id="Tr_NewTarget_0_7" style="display:block;"><table cellpadding="0" cellspacing="0" style="border-width:0;">
				<td><div style="width:20px;height:1px;">

				</div></td><td><div style="width:20px;height:1px;">


WPF Selected xml node from treeview, I want to populate a datagrid with that node and all child node

I have populated a tree view from a xml.  I know want to take the node and all children that has been selected by double clicking on the tree node and populate a data grid.

how to compare to check box list and show selected in first checkbox list


how to show first check box chkched which in show in second check box list

 <table> <tr> <td> <b>Author</b> </td> <td> <b>Reader</b> </td> </tr> <tr> <td> <div style="BORDER: thin solid; OVERFLOW: auto; WIDTH: 200px; HEIGHT:200px"> <table id="Chklist_Author" border="0"> <tr> <td><input id="Chklist_Author_0" type="checkbox" name="Chklist_Author$0" /><label for="Chklist_Author_0">Select</label></td> </tr><tr> <td><input id="Chklist_Author_1" type="checkbox" name="Chklist_Author$1" /><label for="Chklist_Author_1">1029.Aarti</label></td> </tr><tr> <td><input id="Chklist_Author_2" type="checkbox" name="Chklist_Author$2" /><label for="Chklist_Author_2">1025.Akash

TreeView Set Selected Node

You cannot vote on your own post

I am using Visual Studio 2008 Standard Edition, Visual C++, Windows Forms Application.

I would like to set a treeview node to be "Selected" without clicking on it.

I know that you can click on a Node and that Node then becomes the "Selected" Node but how do you force a Node to be "Selected" (with code) without clicking on it?


GridView control to show master-child or master-slave data, written in c#, asp.net

I previously made a master slave datagrid using Visual Studio 2003 .Net (original article) that would allow users to show data to clients using collapse and expand features. These features however did not carry over to gridview for many users. This tutorial will explaing how to create a collapsable/expandable gridview in frameworks 2.0 and higher

Dropdown list in ASP.NET - How to get value selected

am sure this must be very simple, but unforunately I can't figure it out.
I have the following code which populates the dropdown lists from the database. This works fine. Now, when the user selects a particular employee name from the list, I want to get the Employee Id of the selected employee. i.e. I need to get the "Eid" value. I can do this if the EId is loaded in the dropdown list, but in this case only the employee name is displayed. Please let me know howI can get the Eid value even though it is not loaded in the dropdown list.
I would really appreciate your help

Gridview that exports selected rows to Excel

his seems like a messy workaround, but I ended up using two Gridviews - one to display my data and show my checkboxes, and the other which was invisible amd would eventually end up as my Excel spreadsheet.

Show grand total running total in GridView Footer

In many scenarios we need to display Running total as well as Grand total in GridView footer. In this post i will try to explain in an easy way that how we can display running total & Grand total in a GridView footer combindly. To explain this solution using an example here i use a sales order report. The report contains all sales order amount in a tabular way. I will use a GridView to display sales order amount and use GridView footer to display Running total & Grand total. Let we have a customer table with id and name column plus an orders table with OrderID,CustomerID,OrderDate & Amount. Now our goal is to show all customers order with amount as well as page wise running total & grand total. Note that running total is necessary when you enable paging in a GridView where as Grand total is always you can consider.

How to let user edit selected gridview columns, not entire row



I've got a gridview I would like to let the user edit a couple of columns.  Seems like everything I'm coming across so far makes the entire row editable.  

Hopefully the solution isn't too complicated.  Can someone point me in the right direction?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend