Welcome Guest Search | Active Topics | Sign In | Register

TreeView - Selecting just added node. Options
Alex K
Posted: Wednesday, August 8, 2007 2:02:44 AM
Rank: Member
Groups: Member

Joined: 8/2/2007
Posts: 12
Hello dear support,
I`ve been posting my problem with selecting new nodes few days ago and it`s works fine when deleting nodes.
Now I`m trying to select new node in TreeView from client-side using the ClientSideAfterPopulate
Code: JavaScript
function after_populate(treeView, node)
{
    var hid = document.getElementById("mode"); //Hidden field with current mode (add/delete etc.)
    if(hid.value == "add")
    {
        var id = document.getElementById("node_id").value; //new node id
        eo_GetObject("menu").searchItemsById(id)[0].select(); //menu == TreeView
        hid.value="";
    }
}

The problem is when I add new on the server-side I can`t catch event to select it on a client-side.
ClientSideAfterPopulate works fine when I user click on plus icon, how to fire this event from server side, or execute script in other way?
If problem doesn`t clear please see my previos topic:
http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=271

Thanks.
eo_support
Posted: Wednesday, August 8, 2007 7:47:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,095
Hi Alex,

Thanks for posting your question here. I am not exactly sure about what you mean by "how to fire this event from server side, or execute script in other way". How to fire which event? Execute what script?

Thanks
Alex K
Posted: Wednesday, August 8, 2007 8:11:53 AM
Rank: Member
Groups: Member

Joined: 8/2/2007
Posts: 12
Thanks for your attention,
I add node to my TreeView using Button_Add_Click_Server_Event and I want to select new node using Client_Side_Script see post #1. In other words I want to select node just after I add it using node.select()!
eo_support
Posted: Wednesday, August 8, 2007 8:14:48 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,095
Oh....so you are saying that the following code that you posted does not work?

Code: JavaScript
function after_populate(treeView, node)
{
    var hid = document.getElementById("mode"); //Hidden field with current mode (add/delete etc.)
    if(hid.value == "add")
    {
        var id = document.getElementById("node_id").value; //new node id
        eo_GetObject("menu").searchItemsById(id)[0].select(); //menu == TreeView
        hid.value="";
    }
}


And it does not select the item at all? Absolutely does nothing?

Thanks
Alex K
Posted: Wednesday, August 8, 2007 8:28:11 AM
Rank: Member
Groups: Member

Joined: 8/2/2007
Posts: 12
No this code works fine, I can`t activate Client_Side_Script! after Server Side finish work.
eo_support
Posted: Wednesday, August 8, 2007 8:55:21 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,095
Hi Alex,

I see what you are saying! If you add the code on the server side, you don't need to rely on client side code to select it. Just do:

Code: C#
treeNode.Selected = True;


On the server side should take care of it.

Thanks
Alex K
Posted: Wednesday, August 8, 2007 9:07:07 AM
Rank: Member
Groups: Member

Joined: 8/2/2007
Posts: 12
Thanks for reply,
I need to call Client-Side Script with node.select() because I have Update Panel where I want to show some information about new(just added) node!
treeNode.Selected = True; - just select node in TreeView, but node.select() - simulate Click_Event!
Correct me please if I say something wrong!
Thanks a lot!
eo_support
Posted: Wednesday, August 8, 2007 9:18:22 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,095
Hi Alex,

The easiest way is to put a Panel in the page, then do:

Panel1.Text = "<script type='text/javascript'>window.alert('hi!');</script>";

This way you can get any javascript to the client.

Thanks
Alex K
Posted: Thursday, August 9, 2007 4:18:00 AM
Rank: Member
Groups: Member

Joined: 8/2/2007
Posts: 12
Hi support,
Thanks for help, now my TreeView work great!
Thanks again!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.