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: 7/11/2007 5:57:10 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 69 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
8 Items, 1 Pages 1 |< << Go >> >|
AspForumTanya
Asp.Net User
Sort TreeView Nodes7/11/2007 5:57:10 PM

0/0

Hi All,

 Does anybody know how to sort TreeView Nodes after dynamically adding them? The thing is in our code it's being populated dinamically and the only way to sort each node is after population. I found microsoft topic about it but I can't figure out where and how to plug in TreeView.TreeViewNodeSorter Property  

http://msdn2.microsoft.com/en-us/library/system.windows.forms.treeview.treeviewnodesorter.aspx 

Thank you in advance!

 Tatyana

khaos
Asp.Net User
Re: Sort TreeView Nodes7/11/2007 6:16:29 PM

0/0

That is for the winforms treeview not the Webforms treeview :(

As far as I know sorting is a manual process in the webforms tree. Sad


Joe Johnston
Be sure to mark posts as a solution if they are.

omerkamal
Asp.Net User
Re: Sort TreeView Nodes7/11/2007 6:22:36 PM

0/0

TreeViewNodeSorter is only available in windows Forms.

For Web application you have to create your own Property.

There is an Idea for using Client Callback.

this way you can submit your Treeview Nodes (with out a Postback) and on the server side you can do Manual Compare.

See the Article about Client CallBack:

Client Callback in ASP .NET 2.0


 Click to visit
We help with .NET Development. Visit us and share your part!
AspForumTanya
Asp.Net User
Re: Sort TreeView Nodes7/11/2007 7:18:42 PM

0/0

Dah, I can't believe I overlooked the subject of the topic :(

Sorry I don't think I explained that well. The page doesn't need to have sorting enabled on client callback. All I need is once the data is populated for the treeview go through the nodes and put them in the alphabetical order. Although the datatable I'm binding it too is already sorted, when  go through the nodes to populate them the order gets messed up.  Cause the way it's being populated. I'm binding to the specific node by the first letter. Every node has a Header as follows: A, B, C, D, E ... and so on. So when I bind I go throught the datatable and pick and choose the Names in the Datatable according to the letter of the node. So if it's "A" I'm only taking all Publishers which starts with letter "A", and so on until I go through the whole DataTable.

Here is where you can see that example: http://www.programmers.com/PPI_US/PartnerCenter/VendorIndex.aspx  If you expand node "Vendor A" you will see all the vendors, but they are not boudn alphabetical by Publisher Name, instead they are bound by the Publisher ID. Which is how I needed to determine the binding. So the only way to sort is afterwards I think :(

Thank you very much for your help!

Tatyana 

khaos
Asp.Net User
Re: Sort TreeView Nodes7/12/2007 8:54:00 PM

0/0

Could this be as easy as an order by clause in the sql?


Joe Johnston
Be sure to mark posts as a solution if they are.

khaos
Asp.Net User
Re: Sort TreeView Nodes7/12/2007 8:57:08 PM

0/0

DOH!!!  Just re-looked at the post that say its already sorted....

maybe since its bound you need a group by and an order by ... (Grasping at straws now) Tongue Tied


Joe Johnston
Be sure to mark posts as a solution if they are.

AspForumTanya
Asp.Net User
Re: Sort TreeView Nodes7/12/2007 9:34:03 PM

0/0

Yes I printed out the values and it turned out that the object returned from Commerce Server Catalog (My Datatable) is not sorted like it's supposed to :(

But the sort options are set to ppi_publisher_name and not to ppi_publisher_id. But then there is a last code which I think is changing the sort:

1// Get the unique publishers from the datatable

dt.Columns.Add("ppi_publisher_id", _CatalogItems.Tables[0].Columns["ppi_publisher_id"].DataType);
2                    dt.Columns.Add("ppi_publisher_name", _CatalogItems.Tables[0].Columns["ppi_publisher_name"].DataType);
3   
4                    string lastValue = "";
5                    foreach (DataRow dr in _CatalogItems.Tables[0].Select("", "ppi_publisher_id"))
6                    {
7                        if (lastValue != dr["ppi_publisher_id"].ToString() && dr["ppi_publisher_id"] != DBNull.Value)
8                        {
9                            lastValue = dr["ppi_publisher_id"].ToString();
10                           dt.Rows.Add(dr["ppi_publisher_id"], dr["ppi_publisher_name"]);
11                       }
12                   }
13  

 So it's not the treeview but the datatable is not sorted...

 Tatyana

khaos
Asp.Net User
Re: Sort TreeView Nodes7/13/2007 7:03:14 PM

0/0

Glad I could help.


Joe Johnston
Be sure to mark posts as a solution if they are.

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


Free Download:

Books:
Developing Microsoft Office Solutions: Answers for Office 2003, Office XP, Office 2000, and Office 97 Authors: Ken Bluttman, Pages: 608, Published: 2003
Sams Teach Yourself .NET Windows Forms in 21 Days: Guide to Visual Basic Programs Authors: Chris Payne, Pages: 912, Published: 2002
Access 2007 VBA Programmer's Reference Authors: Teresa Hennig, Robert G. Cooper, Rob Cooper, Geoffrey L. Griffith, Armen Stein, Pages: 1110, Published: 2007
Microsoft Visual C# .NET 2003 Developer's Cookbook: Developer's Cookbook Authors: Mark Schmidt, Simon Robinson, Pages: 787, Published: 2003
Mastering Visual Basic.NET Authors: Evangelos Petroutsos, Pages: 1153, Published: 2002
Pro .NET 2.0 Windows Forms and Custom Controls in C#: From Professional to Expert Authors: Matthew MacDonald, Pages: 1037, Published: 2005
What's New in Nine: Visual FoxPro's Latest Hits Authors: Tamar E. Granor, Doug Hennig, Rick Schummer, Toni Feltman, Jim Slater, Pages: 240, Published: 2005
Pro .NET 2.0 Windows Forms and Custom Controls in VB 2005 Authors: Matthew MacDonald, Pages: 1036, Published: 2006
User Interfaces in VB . NET: Windows Forms and Custom Controls Authors: Matthew MacDonald, Pages: 580, Published: 2002

Web:
TreeView.TreeViewNodeSorter Property (System.Windows.Forms) ... of IComparer to perform a custom sort of the TreeView nodes. ... how to use the TreeViewNodeSorter property to sort nodes from smallest to largest. ...
TreeView.TreeViewNodeSorter Property (System.Windows.Forms) There must be two or more root nodes in the TreeView for the custom sort to be applied. Example. The following code example demonstrates how to use the ...
Sort Treeview Nodes - VBForums Sort Treeview Nodes Visual Basic .NET. ... I want to sort all nodes in my treeview. I know only the function sorted=true, but it only sort ...
Sort TreeView Nodes - ASP.NET Forums Does anybody know how to sort TreeView Nodes after dynamically adding them? The thing is in our code it's being populated dinamically and ...
How to sort a TreeView - .NET C# the easiest way to sort a TreeView is to: * add the nodes to an ArrayList * sort the ArrayList with an IComparer * remove the nodes from the TreeView and ...
sort treeview - .NET VB sort treeview. Question posted by: Sam (Guest) on February 9th, 2006 09:15 AM. Hi, How can I sort the root nodes of a treeview according to ...
Sorting a Treeview's ChildNodes Interesting though Jpaulino...that might be a last and final alternative, but there has to be a way in VB 2005 to sort a TreeView's nodes and ChildNodes. ...
Sorting In Treeview Open Discussion about Sorting In Treeview - HIGLIGHTS: sort, treeview, node, visual, cake, style, array, reorder, ordenar, binary, ...
Treeview Reverse Sorting - developerFusion - the global developer ... you may have a treeview like this: Main Node + The Parent | - A | - B | - C | - D This routine will sort ZA so the result should be Main Node + The Parent ...
Sort TreeView Nodes and Child nodes. : treeview, sort What is the best way to sort treeview controls in this order? TreeView - PARENT NODE first. Then sort the Child Nodes alphabetically under the Parent nodes ...

Videos:
Structuring Personal Information When Everything Can Be Saved and Searched... Google TechTalks May 17, 2006 William Jones William Jones is an Research Associate Professor in The Information School at the University of Washingt...




Search This Site:










loggedin template question - probably an easy answer....

custom element while dragging webpart

i cannot create master page after installing .net 2.0

what database and table save extra information from the “createuserwisard / createuserwisardstep” controls ?

redirect to home page

verbs

encypt/decrypt string stored in sql

windows authentication domain

page_load doesn't run on content pages.. :(

multiple site deployment via themes directory

profileprovider

adding a tennis ladder

loginstatus control not directing to a secure https login url

web service data provider

where is the admin tool?

unable to use code-behind feature

having a problem with the personal website template

xcopy deploy

adding my own .aspx without dnn redirecting me? help?

webpart not showing minimize and close links

dottexthelper

how to kill formsauthentication when user log's out.

calling an .exe file from web page

how to get rid of old logon's in web logon control...

how to adjust scrolling in menu control...

impossible to query roles table?

how to force table cell to a certain width?

build web site errors from visual web dev

an error has occured

error in any web part causes the whole wss to go down

 
All Times Are GMT