From 5c93cae9dd1f1783da772b48149cf9e0c3413f0b Mon Sep 17 00:00:00 2001 From: KB Bot Date: Tue, 15 Jul 2025 10:37:00 +0000 Subject: [PATCH 1/3] Added new kb article dockmanager-reset-state --- knowledge-base/dockmanager-reset-state.md | 141 ++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 knowledge-base/dockmanager-reset-state.md diff --git a/knowledge-base/dockmanager-reset-state.md b/knowledge-base/dockmanager-reset-state.md new file mode 100644 index 000000000..053671f6a --- /dev/null +++ b/knowledge-base/dockmanager-reset-state.md @@ -0,0 +1,141 @@ +--- +title: Reset DockManager State on Button Click in Blazor +description: Learn how to reset the DockManager state in Blazor using a button click and save the default state after the initial render. +type: how-to +page_title: How to Reset DockManager State Dynamically in Blazor +meta_title: Reset DockManager State Dynamically in Blazor +slug: dockmanager-kb-reset-state +tags: dockmanager, blazor, state, reset +res_type: kb +ticketid: 1691957 +--- + +## Environment + + + + + + + + + + + + +
ProductDockManager for Blazor
VersionCurrent
+ +## Description + +I want to reset the state of the [DockManager](slug:dockmanager-overrview) in Blazor on a button click. The DockManager currently only resets by reloading the page. I need a solution to reset its state dynamically. + +This knowledge base article also answers the following questions: +- How to reset DockManager layout to its default state? +- How to refresh DockManager without reloading the page? +- How to implement a button to reset DockManager panes? + +## Solution + +To reset the DockManager state dynamically on a button click: + +1. Capture the Default State After Initial Render—Save the default state when the DockManager is first rendered using the [`OnAfterRenderAsync`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.componentbase.onafterrenderasync?view=aspnetcore-9.0) lifecycle method + +2. Reset the State on Button Click—Restore the previously saved state when the button is clicked. + +>caption Reset the DockManager layout to its default state + +````RAZOR +Change something in the DockManager (move, resize, or close panes), then click the button to restore the state +
+
+Reset Dock State + + + + + + +
    +
  • Fix login bug
  • +
  • Implement dark mode
  • +
  • Refactor API requests
  • +
+
+
+ + +

Upcoming Meetings:

+
    +
  • UI Review - Feb 10
  • +
  • Code Freeze - Feb 15
  • +
  • Final Release - Mar 1
  • +
+
+
+ + +

User A updated Task 1

+

User B commented on Task 2

+

New PR merged for Feature X

+
+
+ + + + +

New messages from Sarah

+

Server maintenance scheduled for Sunday

+
+
+ + +

Enable email notifications

+

Change password

+
+
+
+
+
+
+
+ + + + + +

Live chat with team members

+
+
+ + +

Logs and debugging tools

+
+
+
+
+
+
+ +@code { + private TelerikDockManager? DockManager { get; set; } + private DockManagerState? DefaultState { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + DefaultState = DockManager?.GetState(); + } + } + private void ResetDockState() + { + DockManager?.SetState(DefaultState); + } +} +```` + +## See Also + +- [DockManager Overview](slug:dockmanager-overview) +- [Saving and Restoring DockManager State](slug:dockmanager-state) From f1c8a54ba3baeed2168c925d5570599c00b71fcc Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Tue, 15 Jul 2025 13:45:46 +0300 Subject: [PATCH 2/3] chore(DockManager): polish article --- knowledge-base/dockmanager-reset-state.md | 27 +++++++++-------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/knowledge-base/dockmanager-reset-state.md b/knowledge-base/dockmanager-reset-state.md index 053671f6a..3cedc0ed7 100644 --- a/knowledge-base/dockmanager-reset-state.md +++ b/knowledge-base/dockmanager-reset-state.md @@ -11,23 +11,18 @@ ticketid: 1691957 --- ## Environment - - - - - - - - - - - + + + + + +
ProductDockManager for Blazor
VersionCurrent
ProductDockManager for Blazor
## Description -I want to reset the state of the [DockManager](slug:dockmanager-overrview) in Blazor on a button click. The DockManager currently only resets by reloading the page. I need a solution to reset its state dynamically. +I want to reset the state of the [DockManager](slug:dockmanager-overview) component on a button click. The DockManager currently only resets by reloading the page. I need a solution to reset its state dynamically. This knowledge base article also answers the following questions: - How to reset DockManager layout to its default state? @@ -49,7 +44,7 @@ To reset the DockManager state dynamically on a button click:

Reset Dock State - @@ -118,19 +113,19 @@ To reset the DockManager state dynamically on a button click: @code { - private TelerikDockManager? DockManager { get; set; } + private TelerikDockManager? DockManagerRef { get; set; } private DockManagerState? DefaultState { get; set; } protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { - DefaultState = DockManager?.GetState(); + DefaultState = DockManagerRef?.GetState(); } } private void ResetDockState() { - DockManager?.SetState(DefaultState); + DockManagerRef?.SetState(DefaultState); } } ```` From 738805ed3b6c6f83aa56f385f542020e4c479de4 Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:51:10 +0300 Subject: [PATCH 3/3] chore: apply review recommendations --- knowledge-base/dockmanager-reset-state.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/knowledge-base/dockmanager-reset-state.md b/knowledge-base/dockmanager-reset-state.md index 3cedc0ed7..8ee241fb3 100644 --- a/knowledge-base/dockmanager-reset-state.md +++ b/knowledge-base/dockmanager-reset-state.md @@ -5,7 +5,7 @@ type: how-to page_title: How to Reset DockManager State Dynamically in Blazor meta_title: Reset DockManager State Dynamically in Blazor slug: dockmanager-kb-reset-state -tags: dockmanager, blazor, state, reset +tags: dockmanager, blazor, state res_type: kb ticketid: 1691957 --- @@ -22,7 +22,7 @@ ticketid: 1691957 ## Description -I want to reset the state of the [DockManager](slug:dockmanager-overview) component on a button click. The DockManager currently only resets by reloading the page. I need a solution to reset its state dynamically. +I want to reset the [DockManager state](slug:dockmanager-state) on a button click. The DockManager currently only resets by reloading the page. I need a solution to reset its state dynamically. This knowledge base article also answers the following questions: - How to reset DockManager layout to its default state? @@ -33,16 +33,14 @@ This knowledge base article also answers the following questions: To reset the DockManager state dynamically on a button click: -1. Capture the Default State After Initial Render—Save the default state when the DockManager is first rendered using the [`OnAfterRenderAsync`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.componentbase.onafterrenderasync?view=aspnetcore-9.0) lifecycle method +1. Capture and save the default DockManager state in the [`OnAfterRenderAsync`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.componentbase.onafterrenderasync?view=aspnetcore-9.0) lifecycle method. -2. Reset the State on Button Click—Restore the previously saved state when the button is clicked. +2. Restore the previously saved default state when the button is clicked. >caption Reset the DockManager layout to its default state ````RAZOR -Change something in the DockManager (move, resize, or close panes), then click the button to restore the state -
-
+Change something in the DockManager (move, resize, or close panes). Đ¢hen click Reset Dock State @@ -133,4 +131,4 @@ To reset the DockManager state dynamically on a button click: ## See Also - [DockManager Overview](slug:dockmanager-overview) -- [Saving and Restoring DockManager State](slug:dockmanager-state) +- [DockManager State](slug:dockmanager-state)