Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeNode Value in TreeView

Status
Not open for further replies.

netcashin

Programmer
Nov 13, 2000
159
US
Ok, here is what I got. I have a TreeView created with the nodes populatated with text and values properties.

Eventually I am going to pass the value of the checked node, but for now I am content with just getting an alert to pop up with the value of the node selected. The problem is that when I try to retrieve the 'value' property of the node, I get the value 'on'.

Here is code populating the:

<asp:TreeView ID="TreeView1" runat="server" ShowLines="True" onclick="client_OnTreeNodeChecked();" ShowCheckBoxes="all">
<Nodes>
<asp:TreeNode ShowCheckBox="True" Text="Parent1" Value="1">
<asp:TreeNode ShowCheckBox="True" Text="Child1" Value="2"></asp:TreeNode>
<asp:TreeNode ShowCheckBox="True" Text="Child2" Value="3"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode ShowCheckBox="True" Text="Parent2" Value="4">
<asp:TreeNode ShowCheckBox="True" Text="Child3" Value="5"></asp:TreeNode>
<asp:TreeNode ShowCheckBox="True" Text="Child4" Value="6"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>

Now in javascript I am just calling an alert box to display the value (I will skip the rest of the code by the javascript is called when a node checkbox is selected:

alert(treeNode.title); --> Works, displays the text property of the node

alert(treeNode.value); --> Displays 'on' everytime while I would like for it to display the value of the node

Thanks in advance for any help.
 
try forum855 or forum216

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top