I have a web user control which has a Treeview control inside it. I have created another user control which contains a Gridview along with a couple of other controls.
The Gridview, should update itself whenever the user selects a different TreeNode from my Treeview.
After some searching, What could possibly be the solution:
- Add and raise an event from the user control that fires when the Treeview selected node changes. Creating a custom event argument that contains the node value, allows it to get passed directly to the event handler.
If so, can you show me a basic working example which implements this approach?
Thanks.
You could let your main page code behind handle a custom event from the Treeview control. Then in the event handler call a public method in the gridview control.
If control1 is your tree control and control2 is your grid control:
Main Page aspx (set control1 event handler to a method in this page):
Main Page code behind:
Tree control code
Grid control code