ReloadWebPart Overview

The “ReloadWebPart” service is used to reload specific webpart(s) in a page. This service is very useful when we’re dealing with nested webparts. For instance, we have Webpart-1 as our container webpart which has Webpart-2, Webpart-3, and Webpart-4 in it. If we only wanted to reload Webpart-2 and Webpart-4, then “ReloadWebPart” service comes very handy as we can’t accomplish this by any other service easily.

ReloadWebPart Use Examples

ReloadWebPart Basic Use

In this example we have account summary loading from a different webpart, and we have a button which uses ReloadWebPart service to reload the Account Summary Webpart. Here’s how the Webpart View looks like:

ReloadWebPart services takes WebPartId as the only input. Here’s how the input looks like for this service:

Notice that we can right click on WebPartIds input to add multiple webparts to reload at once.

ReloadWebPart in SendMessage(Admin ChatRoom)

In this use case when an admin sends a message, we add it to the database, clear the message webfield, and reload the same webpart. Here’s a closer look at the process:

In the output logs we can see all the webparts that were reloaded by the service. Here’s how the output looks in  logs:

In this case we are reloading only one webpart, and we can see it’s webpart Id in the logs.