Introduction
Imagine a user profile that must be rendered repeatedly with different data. The first render shows Adriano from Olbia. The second shows Mohammad from Tehran. The third shows someone else entirely.
If every render modifies the result of the previous render, the DOM can gradually accumulate unwanted changes: a leftover attribute, a stale value, or an element that was created by an earlier operation. Over time, the structure can drift away from the original HTML.
This raises an important question:
How can a server describe a fresh UI rendering without sending the entire page again?
WebForms Core 2.2 addresses this problem with Render, a structural rendering model built around a simple idea:
Keep a stable rendering base, restore it when necessary, and apply a new set of commands to produce the desired UI.
This capability extends the Server-Orchestrated UI architecture of WebForms Core. The server acts as the commander, while WebFormsJS executes the generated commands in the browser.
Instead of maintaining a synchronized client-side application state or a virtual representation of the entire UI, WebForms Core operates directly on the existing HTML DOM.
The concepts involved are not individually new. Server-driven UI, executable commands, HTML templates, and state restoration have all appeared in different forms across web architectures. The interesting part of WebForms Core 2.2 is how these ideas are combined through a stateless server, lightweight commands, HTML-native structures, sequential DOM execution, offline command availability, and structural rendering with Render, Snapshot, and Rollback.
This article explains how that model works and where it differs from more familiar client-side rendering approaches.
The WebForms Core Rendering Model
The basic WebForms Core flow is:
Server
↓
WebForms
↓
Commands
↓
WebFormsJS
↓
HTML DOMWebForms Core does not send a component tree to the browser. It does not require JSX, a client-side component compiler, or a virtual DOM.
Instead, the server generates commands that WebFormsJS executes against the existing HTML DOM. This architecture is referred to as Server-Orchestrated UI.
One important characteristic of this model is that it focuses on command flow rather than only data flow.
In many Server-Driven UI approaches, the server describes data or a UI representation and the client interprets that information. WebForms Core instead allows the server to orchestrate operations against the client-side DOM.
Server-Driven UI
Server
↓
UI Description / Data
↓
Client Renderer
↓
DOMWebForms Core
Server
↓
WebForms Commands
↓
WebFormsJS
↓
DOM Operations
↓
HTML DOMThe server can express operations such as:
Read DOM
Modify DOM
Move data
Copy data
Replace content
Change attributes
Insert
Remove
Swap
Fetch
Bind
Render
Store
RestoreA WebForms Core response can also contain constructs such as nested conditions, foreach operations, asynchronous operations, repetition, exception handling, DOM-isolated execution, and delays.
The important distinction is that these operations are generated as commands on the server and executed by the client runtime. The server does not have to execute the browser-side DOM operations itself.
HTML and Commands Are Loosely Coupled
HTML remains the document structure, while WebForms commands provide an execution layer that operates on that structure.
HTML
↕
WebForms Commands
↕
WebFormsJSThe HTML does not have to become a component definition. Commands do not need to be embedded into every element they operate on.
This separation allows the HTML structure and command layer to evolve independently while still working together through WebFormsJS.
Commands Operate on the Result of Previous Commands
WebForms Core commands are executed sequentially.
A command does not necessarily operate only on the HTML that existed when the response arrived. A previous command can create an element, and a subsequent command can immediately operate on it.
Initial HTML
↓
Command 1 → Create <div id="result">
↓
New HTML
↓
Command 2 → Set content of #result
↓
Modified HTML
↓
Command 3 → Change attribute of #result
↓
Command 4 → Insert another element into #result
↓
New ResultTherefore:
The output of one command can become the input structure for the next command.
A WebForms Core response is not simply a collection of independent UI updates. It is an executable sequence of DOM operations.
The Server Orchestrates, the Client Executes
The architecture can be visualized as:
Server
│
▼
WebForms Commands
│
▼
WebFormsJS
│
▼
Current DOM
│
┌───────┴───────┐
▼ ▼
Command 2 Command 3
│ │
└───────┬───────┘
▼
New DOM StateThe client is not merely a renderer of server-provided data. It provides the execution environment for server-orchestrated UI operations.
The server can therefore describe both what should happen and which DOM operations should be performed.
This command-oriented model explains how WebForms Core executes UI changes. It does not yet explain how repeated renders remain stable. That is the problem Render addresses.
What Is Render?
Consider a section of HTML containing templates:
<div id="user">
<field>{{name}}</field>
<a href="mailto:{{email}}">{{email}}</a>
<field>{{phone}}</field>
<field>{{age}}</field>
<field>{{city}}</field>
<field>{{country}}</field>
</div>The server can render this section using:
WebForms form = new WebForms();
form.Render(f =>
{
f.Replace(InputPlace.Root, "{{name}}", name);
f.Replace("-", "{{email}}", email);
f.Replace("-", "{{phone}}", phone);
f.Replace("-", "{{age}}", age);
f.Replace("-", "{{city}}", city);
f.Replace("-", "{{country}}", country);
}, "user");
Write(form.Response());The final argument, "user", identifies the rendering target.
The original HTML acts as the rendering base. The server then applies the requested transformations.
For example, the result could become:
<div id="user">
<field>Adriano</field>
<a href="mailto:[email protected]">
[email protected]
</a>
<field>0145221188</field>
<field>43</field>
<field>Olbia</field>
<field>Italy</field>
</div>Only the required section changes. The complete page does not need to be regenerated.
The replacement commands describe the visible transformations, while "user" identifies the target on which the rendering process operates.
The Important Difference: Render Has a Base
The most important characteristic of Render is not simply that it replaces values. It is that the rendering operation has a stable base.
When Render is used for the first time for a target, WebForms Core establishes a copy of that target as the rendering base. The requested modifications are then applied.
On a subsequent render of the same target, the rendering process can begin from that original base again.
Initial HTML
│
▼
Snapshot
│
├── Render A
│ └── Result A
│
├── Restore Snapshot
│ │
│ └── Render B
│ └── Result B
│
└── Restore Snapshot
│
└── Render C
└── Result CThis differs from repeatedly modifying the result of the previous modification.
Suppose the first render produces:
<field>Adriano</field>A second operation changes it to:
<field>Mohammad</field>If every operation works directly on the previous result, the DOM becomes the accumulated result of previous operations.
With a stable rendering base, each rendering operation can instead work like this:
Base
↓
Render 1 → State 1
Base
↓
Render 2 → State 2
Base
↓
Render 3 → State 3The rendering process can therefore be repeated from a known structural state.
This can be useful for:
Forms
Dashboards
Configuration panels
Dynamic records
Filters
Reusable UI fragments
Server-generated interfaces
Render Is Not Just Another Replace Operation
At first glance, Render may look like a convenient wrapper around replacement commands. Its architectural role is broader.
Replace describes an individual operation:
Change this value.
Render describes a rendering process:
Start from this structural base, apply these transformations, and produce the rendering result.
This makes Render a higher-level abstraction built on top of WebForms Core's command system.
How Render Works Internally
A stable rendering base prevents accumulated mutations from becoming the starting point of subsequent renders. However, the rendering process also needs to prevent intermediate changes from leaking into the live DOM.
WebForms Core addresses this with TransientDom.
The Render method is built around two lower-level concepts:
Snapshot/RollbackTransientDom
Snapshot and Rollback
A lower-level API can capture a structural state using:
Snapshot("default");That state can later be restored with:
Rollback("default");The basic sequence is:
Snapshot
↓
Modify
↓
Modify
↓
Rollback
↓
Modify AgainMultiple snapshots can represent different structural states:
Snapshot("empty")
Snapshot("loaded")
Snapshot("editing")
Snapshot("preview")A target can then be restored to a selected state before applying additional commands.
┌── Snapshot("empty")
│
HTML Target ─────┼── Snapshot("loaded")
│
└── Snapshot("editing")Then:
Rollback("loaded")
↓
Apply Commands
↓
New UIThis makes Snapshot and Rollback useful as lower-level primitives, while Render provides a higher-level rendering abstraction.
The initial snapshot used by Render can be considered its Render Base.
TransientDom: The Isolation Layer Inside Render
The implementation of Render shows how the stable base and isolated execution work together.
// The Render Method is Sensitive to DOM Changes.
// It is Recommended to Assign a Stable ID to the Selected Element.
// This Method Utilizes the Transient DOM.
// When Selecting InputPlaces, Consider the Root of the
// Selected InputPlace Within the Method.
public WebForms Render(
WebForms newForm,
string InputPlace,
string Key = "",
bool Permanent = false)
{
if (newForm == null)
return this;
string bodyData = newForm.GetWebFormsData();
if (string.IsNullOrEmpty(bodyData))
return this;
if (string.IsNullOrEmpty(Key))
Key = InputPlace;
WebForms form = new WebForms();
form.Exist(Permanent ? Fetch.Cache(Key) : Fetch.Save(Key));
form.Rollback(InputPlace, Key, Permanent);
form.Else();
form.Snapshot(InputPlace, Key, Permanent);
form.StartTransientDOM(InputPlace);
AppendForm(form);
newForm.EndTransientDOM();
AppendForm(newForm);
return this;
}This reveals the sequence behind a Render operation.
1. Check for an Existing Rendering Base
form.Exist(...) checks whether a snapshot already exists for the specified key.
2. Restore or Establish the Base
If the snapshot exists, Rollback(...) restores the target to its stored structural state.
If it does not exist, Snapshot(...) captures the current state as the rendering base.
3. Open a Transient DOM Scope
form.StartTransientDOM(InputPlace) establishes an isolated rendering scope.
Subsequent modifications are applied to the cloned target rather than directly to the live DOM.
4. Apply the New Commands
The commands defined in newForm are appended and executed inside the transient scope.
5. Close the Scope and Replace the Target
The transient DOM is finalized, and the modified clone replaces the original target.
This is why the implementation includes warnings about using stable element identifiers and considering the root of the selected InputPlace when working with the transient DOM.
Because Render operates on a clone of the target rather than directly modifying the live DOM, the rendering process is isolated by design.
This provides several useful properties:
Modifications remain within the selected rendering scope.
Unrelated elements are not part of the rendering operation.
The rendering base remains available for subsequent renders.
The modified clone can replace the original target as a completed operation.
The Combined Model
Render can therefore be understood as a composition of three ideas:
Snapshot / Rollback
↓
Stable Rendering Base
+
TransientDom
↓
Isolated Execution Scope
+
Commands
↓
Structural TransformationsThis makes Render a structural rendering model rather than simply a convenience wrapper around Replace.
The server orchestrates a sequence of operations:
Capture Base
↓
Isolate Target
↓
Apply Commands
↓
Replace TargetRender and TransientDom
Aspect | Render | TransientDom |
|---|---|---|
Purpose | Stable rendering base with isolated rendering | Isolated modification within a scope |
Mechanism | Exist → Rollback/Snapshot → StartTransientDOM → Commands → EndTransientDOM | Clone → Apply commands → Replace |
Scope of effect | Entire selected target, isolated through the transient DOM | Specified DOM scope |
Internal relationship | Uses TransientDom internally | Can be used independently or inside Render |
Primary use | Repeated rendering from a fixed base | Temporary, isolated modifications |
TransientDom can therefore be viewed as the isolation layer that supports the Render process.
Examples
Example 1: Multiple Templates with Snapshot and Rollback
Snapshot and Rollback can be used independently of the higher-level Render method.

Join the conversation! Your thoughts help the community grow.