I have a WebHierarchicalDataSource created and set relations visually on aspx page.
I need to filter the undelying dat ato display in the Ultrawebtree. I can change the SqlDataSource.SelectCommand for both data sources (just two levels in the tree) and it filters fine. The only problem is that each parent node appears as many times as there is a max och child nodes. My guess is that the Relationship in WebHierarchicalDataSource needs to be reset.
What is the proper syntax to do that? Or is it a different problem?
Here is the snip of the code I am using:
SqlDataSource2.SelectCommand =
SqlDataSource1.SelectCommand = "SELECT tClients.ClientID, tClients.ClientName FROM ...
WebHierarchicalDataSource1.DataBind()
UltraWebTree1.DataBind()
UltraWebTree1.ExpandAll()
Thanks
Hi,
The information you have provided is insufficient for me to solve the issue.
bilko73 said: I have a WebHierarchicalDataSource created and set relations visually on aspx page.
How exactly you are doing that?
bilko73 said:The only problem is that each parent node appears as many times as there is a max och child nodes.
I don't understand that, can you please explain in more detail?
bilko73 said:My guess is that the Relationship in WebHierarchicalDataSource needs to be reset.
WHDS Relation itself can not be reset, maybe you are trying to clear the relations collection? If so you can use the Clear() method.
If that doesn't help please provide more info and the complete source code (or sample project).
I figured out how to clear the relations. How do I rebuild it programatically?
Maybe I need to rephrase the question.
I have a page with UltraWebTree bound to WebHierarchicalDataSource. The default data source is set to display all data from database (Clients as parent nodes and Projects as a child nodes). I need to filter this information based on an entry in a text box. User enters a search string and hits a Search button. The button click event applies a WHERE clause to both the parent and child data sources of the WebHierarchicalDataSource. That all works and only the searched for projects are displayed in the UltraWebTree. BUT, For some reason the parent node is retrieved as many times as there are child nodes
Example:
I am searching for ProjectName containing string "Station". There are three projects from the same Client. So the child data source returns "Station1, Station2, Station3". The Parent node Client should be displayed only once as such in the WebTree:
Shell Station1 Station2 Station3
Instead I get the following:
Shell Station1 Station2 Station3Shell Station1 Station2 Station3Shell Station1 Station2 Station3
in the WebTree
How can I fix this? Do I need to recreate the relationship in the WebHierarchicalDataSource from the codebehind, or do something else?