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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clent Side (JS) help needed RE .net 2.0 treeview control

Status
Not open for further replies.

fersotel

Programmer
Feb 1, 2008
2
GB

I've disabled the postbacks on the frame that has the treeview. When I click a node I have an event that fires in Javascript and passed a parameter to another frame in the webpage. Problem is, I don't know who to extract anything other than the selected node value, here is my code:

function treeview_click()
{
var iNode = 0;

iNode = document.getElementById('TreeView1_SelectedNode').value;
window.parent.frames(2).location.href = 'content1.aspx?NodeNo=' + iNode;
}

This just gives back the node number that is set by the control, I want to pull back any of the other information set in the node, i.e. string text and string value set on creation

Can anyone help, thankyou for reading this

John

 

Thanks for helping, i'm pretty stuck with this right now.

I have a stored proc with this SQL:
select
t.parent as parentnodeid,
t.child as childnodeid,
(select treeitem from treeitem where treeitemid = t.child) as
ItemDesc, t.orderindex, t.treeid from tree t order by
t.parent,t.orderindex

I populate the tree with the following two procedures, one is recursive:


> private void CreateTree(DataTable dt)
> {
> DataView view = new DataView(dt);
> view.RowFilter = "parentnodeid IS NULL";
>
> foreach (DataRowView row in view)
> {
> TreeNode newNode = new TreeNode(row["ItemDesc"].ToString(),row["childnodeid"].ToString());
> TreeView1.Nodes.Add(newNode);
>
> newNode.NavigateUrl = "javascript:void(0);";
> AddNodes(dt, newNode);
> }
> }
>
> private void AddNodes(DataTable dt, TreeNode Node)
> {
> DataView view = new DataView(dt);
> view.RowFilter = "parentnodeid=" + Node.Value;
>
> Trace.Warn("parentnodeid=" + Node.Value);
>
> foreach (DataRowView row in view)
> {
> Trace.Warn(row["ItemDesc"].ToString() + " " + row["childnodeid"].ToString());
> TreeNode newNode = new TreeNode(row["ItemDesc"].ToString(), row["childnodeid"].ToString());
> Node.ChildNodes.Add(newNode);
>
> newNode.NavigateUrl = "javascript:void(0);";
> //newNode.NavigateUrl = "javascript:window.parent.frames(2).location.href = 'content1.aspx?NodeNo=" + row["TreeId"].ToString() + "'";
> newNode.ToolTip = row["TreeId"].ToString();
>
>
> AddNodes(dt, newNode);
> }
> }

The I have a client side Javascript click event that does the following - returning the node number in the sequence:



function treeview_click()
{
var iNode = 0;

iNode = document.getElementById('TreeView1_SelectedNode').value;
window.parent.frames(2).location.href = 'content1.aspx?NodeNo=' + iNode;

iNode = document.getElementById('TreeView1_SelectedNode')
//alert(iNode.getAttribute('NavigateUrl'));
}

I cannot find a way to get back any other node values except the sequence that gets set by the control. I want to get the treeid from my table or anything else

Many thanks again for reading

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top