This is a migrated thread and some comments may be shown as answers.

Initialize RadDock when opened

1 Answer 78 Views
Dock
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 23 Aug 2011, 09:03 AM
Hi,

I have a RadListBox embedded into a RadDock. When the RadDock is opened (MyRadDock.Closed = false), I want to clear
the RadListBox.
At the moment, when the RadDock is closed and opened again, the ListBox still contains the items from the previous command call.

Unfortunately I don't find an event which is fired when the RadDock is opened. The client-side event "OnClientInitialize" is also called on PostBack but I want to preserve the ListBox content during a PostBack (which currently works fine) when the RadDock is opened.

Do you have any idea how I can clear the RadListBox every time the RadDock is opened but not on a PostBack?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Slav
Telerik team
answered on 25 Aug 2011, 01:30 PM
Hello Jan-Patrick,

If I understand correctly your request, you want to clear the RadListBox when the RadDock is closed, and then to populate it with data again when the RadDock is opened, but only if it has been already closed and not on every PostBack.

You can clear the RadListBox on the OnCommand event of the RadDock. In the handler of this event you can check whether the close button has been clicked and if it is so, you can clear the RadListBox.

You won't need event, fired when the RadDock is opened, in order to bind new items to the RadListBox. You can achieve this from the place in your code, where the RadDock is being opened. For example, if you use a button to open the dock, on that button's Click event you can set new items for the RadListBox.

In order to visualize my point, I have attached a sample project, demonstrating the described implementation. You may use it as a reference to incorporate the feature into your actual project.

I hope the presented solution meets your requirements. Pleas let us know if you are still experiencing problems with implementing the desired functionality.

Regards,
Slav
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Dock
Asked by
JP
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or