CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 2/15/2008 9:36:44 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 84 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
8 Items, 1 Pages 1 |< << Go >> >|
lax4u
Asp.Net User
How to set focus on TreeNode?2/15/2008 9:36:44 PM

0/0

How to set focus on TreeNode? I have a treeview with lots of nodes. TreeView has focus method but TreeNode doesn't. When i select something in dropdown list. depending on that i want to set the focus on treenode in treeview.

string text = DropDownList1.SelectedItem.Text;

TreeNode node = TreeView1.FindNode(text);

node.Select();

but this doesnt work. focus wont go to this node.

amensi
Asp.Net User
Re: How to set focus on TreeNode?2/15/2008 9:48:36 PM

0/0

you can use SelectedNode. assign it to the node you want to select:
this.treeView1.SelectedNode = mynode;


Alex Mensi - Check out my blog
Maven Technologies Inc.
--
Don't forget to click "Mark as Answer" on the post that helped you.
Amanda Wang - M
Asp.Net User
Re: How to set focus on TreeNode?2/18/2008 7:13:11 AM

0/0

Hi,

lax4u:

string text = DropDownList1.SelectedItem.Text;

TreeNode node = TreeView1.FindNode(text);

node.Select();

but this doesnt work. focus wont go to this node.

Where did you put this code? Do you put this code in the page load event?

I just put these code in the dropdownlist's SelectedIndexChanged event, it works well.

Do you set the treeview's SelectedNodeStyle? or else you cannot see the effect of the node has been checked.

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
lax4u
Asp.Net User
Re: How to set focus on TreeNode?2/18/2008 3:02:37 PM

0/0

Amanda, Its on User Control's Page Load event.

Amesi, isn't selected node is readonly property?

lax4u
Asp.Net User
Re: How to set focus on TreeNode?2/18/2008 3:33:04 PM

0/0

Amanda, why do i need to set selected style property? Is it just to see if the node is selected or not? Actually what i'm doing. I have lots of links with their headers. So i'm using treeview to show these links. Also at the top of the page i have list of headers too. So when user click on one of the header in the list at the top. I want the focus should go to that header in TreeView.

The list at the top looks like this

Header1
Header2
Header3
Header4

and treeview looks like this

Header1
  link1
  link1
  link1
Header2
  link1
  link1
  link1
Header3
  link1
  link1
Header4
  link1
  link1
  link1
  link1

 

lax4u
Asp.Net User
Re: How to set focus on TreeNode?2/18/2008 4:00:56 PM

0/0

the node gets selected but the focus doesnt go there. I still have to scroll down manually to check if its selected or not. I want focus to go there. and TreeNode does not have focus method.

lax4u
Asp.Net User
Re: How to set focus on TreeNode?2/18/2008 7:49:20 PM

0/0

after searching for a while on the internet i found this solution. We have to use javascript to find selected node on client side and the use scrollIntoView method to scroll.  from this link http://www.thescripts.com/forum/thread494008.html check the 3rd Last post.

BUT in my case, suppose i have button and when i click on the button i want to focus to particular node. But node gets selected on server side and client script executes before that. So if i execute above mentioned javascript then it will not find selected node. So i was planning to use startup script in click event of button, but it still not finding the SelectedNode on client side.

here is my code

protected void Button2_Click(object sender, EventArgs e)

{

TreeNode node = TreeView1.FindNode("Header3");if (node != null)

{

TreeView1.Focus();

node.Select();

}

string treeviewid = TreeView1.UniqueID.Replace("$", "_");

string s = "var name = " + treeviewid + "_Data.selectedNodeID.value;";

s += "var selectedNode = document.all ? document.all[name] : document.getElementById(name);";

s += "if (selectedNode) { selectedNode.scrollIntoView(true); }";

Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript",s,true);

 

}

any idea

lax4u
Asp.Net User
Re: How to set focus on TreeNode?2/25/2008 4:31:59 PM

0/0

anybody know the answer?...suppose TreeView1 is the uniqueid for TreeView then TreeView1_Data remains null on when javascript run on startup

8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Visual Basic .NET Database Programming: database programming Authors: Rod Stephens, Pages: 405, Published: 2002
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
ASPLOS-X Proceedings: Tenth International Conference on Architectural Support for Programming Languages and Operating Systems, San Jose, California, October 5-9, 2002 Authors: Association for Computing Machinery, Sigarch, ACM Special Interest Group in Operating Systems, ACM Special Interest Group on Programming Languages, Pages: 320, Published: 2002
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
C# Professional Projects Authors: Geetanjali Arora, Balasubramaniam Aiaswamy, Nitin Pandey, NIIT (Corporation), Pages: 919, Published: 2002
.NET Windows Forms in a Nutshell: A Desktop Quick Reference Authors: Ian Griffiths, Matthew Adams, Pages: 879, Published: 2003
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Intelligent Information Technology: 7th International Conference on Information Technology, CIT 2004, Hyderabad, India, December 20-23, 2004 ; Proceedings Authors: Gautam Das, Ved Prakash Gulati, Pages: 428, Published: 2004

Web:
How to set focus on TreeNode? - ASP.NET Forums How to set focus on TreeNode? I have a treeview with lots of nodes. TreeView has focus method but TreeNode doesn't. ...
Treeview node set focus question - .NET VB Can anyone tell me how do I set focus on a particular treenode at run time? If you need to know what I'm try to do please read on . ...
CodeGuru Forums - Remove focus from TreeNode I have a TreeControl with a few TreeNodes. If I set the focus to the TreeControl at the first time there is no TreeNode selected. ...
How to set focus after Ext.Msg.alert ? - Ext JS Forums But after closing the Msg box, how can I set the focus ob the selected node again ? ... the 'UP' and 'DOWN' keys don't select the previous or next treenode. ...
CodeProject: How to set focus to a MS ASP.NET TreeView on form ... This article will provide some tips on setting focus to a TreeView control.; Author: SeaWater; ... Dim tn As New TreeNode() Dim tnChild As New TreeNode() ...
treenode.focus A function to select treenode, that is make it the currently selected node in its tree window. This action will invoke any relevant callbacks defined for ...
Tree Node Loses Focus When Item in Different Frame is Clicked ... Tree Node Loses Focus When Item in Different Frame is Clicked. Submitted by pcarrollnf on Mon, 09/08/2008 - 13:38. ...
treeNode (RichFaces JSF components library Tag library documentation) The component is designed for creating sets of tree elements ... String ), id of element to set focus after request completed on client side ...
TreeNode.Target Property (System.Web.UI.WebControls) Renders the content in the frame with focus. ... Do not set the Target property if the rendered output for the TreeNode object must be XHTML 1.1-compliant. ...
Maintain ASP.NET Tree Position on Postbacks Nov 15, 2006 ... Add(New TreeNode("Pork Loin with Peanut and Madarin Orange Sauce")) ... Focus Tree Node on Postback ...




Search This Site:










jscript.net friendly?

removeabandonedcarts job

error: log viewer is currently unavailable. dnn 3.1

forums

icon issue

removing the background picture

announcing magichyperredirect: a free module to replace magicredirect

webstone/shadow module link down

formatted entries and creating another table into clubsite

how to know if running on virtual server?

login web appa from another web appb using network login id

remember me not working

publish website doesnt work

counter for ibuyspy portal

dnn database offline at webhost4life

could we use vs 2005 image library in our apps ?

error while trying to install on a shared hosting!

copying tab data to a new tab

looking for (before i code one myself)

how to use freetextbox from the code?

javascript code outliner

dnn for an "arty" 700x300 centred viewport site?

i can't get a vs2008 solution to compile (hangs)

how to different sitemap for admin and simple user

query builder gone haywire

tabs in 2.0

1.1 to 2.0 upgrade and publish to iis 6.0 server resulted in 'webform_postbackoptions is undefined'

skin not showing when logged in as admin/host

visual web developer express 2005 download problem

customize sitemap breadcrumb view with code behind

 
All Times Are GMT