Welcome Guest Search | Active Topics | Sign In | Register

TreeView Options
Matt
Posted: Tuesday, December 23, 2008 2:40:06 PM
Rank: Newbie
Groups: Member

Joined: 12/23/2008
Posts: 3
I want to load area names and their corresponding station names in to a
TreeView from a database (each station has a unique ID). Then when users
click a station name, I want to display the station description (field in the db) in a panel
to the right of the TreeView.

What's the best way of doing this? Do you have any documents or examples?
How/where do i store each record ID?

Many thanks
Saed
Posted: Tuesday, December 23, 2008 3:29:45 PM
Rank: Advanced Member
Groups: Member

Joined: 10/15/2008
Posts: 45
If I'm to handle this, I would utilise TreeNode properties as follows:

Node's ItemID: set to Station unique ID.
Node's Text: Station Name.
Node's Value: Station Description (to be displayed in right panel).

Shall you need to store more info, you could combine them into Node's Value in a certain way, then retrieve whichever portion you desire later on.

Good luck.

Regards,

Saed Hamdan
"Man may be destroyed but not defeated" -Hemmingway
eo_support
Posted: Tuesday, December 23, 2008 4:18:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

I believe Saed pointed out a few key properties (Thanks!). We will try to provide you some additional information and hope it can be helpful to you.

You may want to start from the data binding process. You can get more information about that at here:

http://www.essentialobjects.com/ViewDoc.aspx?t=MenuCommon%2fDataBinding%2fDataBinding_overview.html

These topics cover different scenarios/models that you can use to populate your TreeView from your database. You will want to go over those and see which model fits you best.

While you are populating the TreeView, you may want to map/store certain fields to certain properties (you can find details about this in the documentation). The most frequently used, as Saed pointed out, are ItemID, Text and Value.

Once you have the TreeView populated, the next task is to display the station description in the Panel on the right. I would suggest you to complete this by two steps:

1. Set the TreeView’s RaisesServerEvent to true. You can then handle the TreeView’s ItemClick event on the server side. Inside your server side ItemClick event handler, you can get whatever information you stored in the TreeNode (for example, StationID from Value property), use that information to locate the corresponding record in the DB, then fill the right panel based on the information you get from your DB record;

2. Once you get that step working, you can try to improve it by either using a CallbackPanel/UpdatePanel to avoid full page reload, or even using our client side JavaScript interface to implement any additional logics. However you will want to get the first step working before moving further;

Hope this helps.

Thanks!
Matt
Posted: Wednesday, December 24, 2008 4:17:41 AM
Rank: Newbie
Groups: Member

Joined: 12/23/2008
Posts: 3
Thank you. The server side code is working and data is being pulled in from the database. What is the best way of now moving the code to using client side scripting?

Thanks
eo_support
Posted: Wednesday, December 24, 2008 5:31:37 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

First you want to take a look of our client side JavaScript interface to see how to use them and what they can do. The client side JavaScript interface is meant to be an addition, not a replacement of the server side interface. So all your server side code will still need to be there.

The following link explains how to use our client side JavaScript interface in general:

http://www.essentialobjects.com/ViewDoc.aspx?t=clientapi_howto.html

This link provides more details on TreeView client side JavaScript interface:

http://www.essentialobjects.com/ViewDoc.aspx?t=MenuCommon%2fHandlingEvent%2fclient_event.html

If you also use CallbackPanel, you can find more information here:

http://www.essentialobjects.com/ViewDoc.aspx?t=Callback%2fusing_callback.html

Once you are familiar with how to use them and what they can do, you can decide whether they can be used to implement any of your functionalities or improve your app’s usability.

Thanks!


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.