|
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=271Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
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
|
|
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()!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
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
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
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
|
|
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!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
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
|
|
Rank: Member Groups: Member
Joined: 8/2/2007 Posts: 12
|
Hi support, Thanks for help, now my TreeView work great! Thanks again!
|
|