I want to capture the click event on a tree view as I have to navigate on some other page when user clicks on an Element of hierarchy.
If you are overriding the tree you can override the methods OnBeforeSelect and OnAfterSelect.
If you are using the tree view in your application you can sign up for the BeforeSelect and AfterSelect events.
Can you please elaborate a little ( How to Override ) Onbeforeselect and onafterselect is a AFSDK funcltionality or I need to override from outside
The before and after select events are on the AF tree view control contained in the OSIsoft.AF.UI assembly. This is where the AF UI window controls are found.
Let's say you are using an AF tree view in your application and its name is afTreeView. Then one easy way to sign up for the AfterSelect (or BeforeSelect) events is to click on the afTreeView in visual studio's designer window for the containing dialog or control and select properties. At the top of the properties window you'll see a lightening bolt icon. Hovering over this will show a tooltip with the text Events. Select this Events icon and the list of all AF tree view events will appear. Scrolling down you should see AfterSelect in the list. Further down in the list the BeforeSelect will appear.
If you want the AfterSelect event to fire just double-click on the AfterSelect label and a new event delegate will be created and added to your project. The double-click will also open your source file at the location for the AfterSelect delegate just created. This is where you will add your code to handle the AfterSelect event. You can repeat the steps to add the BeforeSelect delegate.
By the way, both of these events are inherited from Microsoft's treeview control. Here's a link to the help for the AfterSelect:
Inside the after select delegate you can access the AF object associated with the selected node like this:
AFTreeNode node = e.Node as AFTreeNode;
AFElement element = node.AFObject as AFElement;
Of course you should probably test the node and element for non-null before using, but if you're using an AFTreeView displaying elements then this should work just fine.
I want to explain case in which I am working,
I am developing a dashboard using sharepoint in which I have written customized webservices for connecting and getting data.
Now In that I want to click a element and as a result ( Tree View will work like provider ) I want to pass that context to other customized webpart or page, please suggest
I have tried the way you suggested in previous reply but those controls are windows based and I am unable to add those while developing dashboard.
Although I'm not familiar with sharepoint programming, I'm guessing you want the an approach in passing the element information from one page to another? If so, then I'd suggest using the element.GetPath and pass the object as a string. The page then can get back the object by using: AFObject.FindObject(name) where name is the string is the returned from the GetPath method. The string returned from GetPath can be stored with the tree node.
From my understanding you have created your own TreeView webpart, and want to communicate with other webparts in the same page (or in different pages).
I'd recommend you use the same communication interfaces OSIsoft uses in PI Webparts. This will enable your custom webparts to communicate back and forth with PI Webparts and you own webparts, both client side and server side.
A webpart which should send data should implement the IParametersOutProvider interface, and a webpart which should receive data should implement the IParametersOutConsumer interface. Take a look at this blog post to get started: vcampus.osisoft.com/.../how-to-create-custom-webparts-that-connects-with-osisosft-s-rtwebparts.aspx
And also search for all my posts in the PI Webparts and PI Coresight forum, I've given a lot of assistance on this subject in the past.
Retrieving data ...