ApprovalTrail
Wisej.NET 4.2.0+
The ApprovalTrail control displays the chain of people who sign off on a request: a portrait for each participant, their name and role, the state of their decision and its date, the comments they left, and Approve and Reject buttons for the decision that is due. Use it on a purchase request, an expense report, a leave request, or a contract review.
The control shows the workflow; it does not run it. Approving or rejecting raises an event and changes nothing on its own: your application checks that the current user may decide, persists the decision, and updates the steps. The control does not authenticate or authorize anyone.
For a complete list of properties, methods, and events, see the API documentation.
Features
Participants and States
The Steps collection holds one ApprovalStep per participant, in order. Each step has a Text (the name), a SubText (role or department), an Image for the portrait, a State, a Date, and a Comment. Without an image, the portrait shows the participant's initials on a colour derived from the name.
State is one of Approved, Pending (a decision is requested from this participant), Waiting (waiting for an earlier decision), Rejected, or Skipped. Changing the state of one step never advances another: the application decides who is next.
Actions
While ShowActions is true (the default), Approve and Reject buttons are shown for the first Pending step in collection order. Clicking them raises Approved or Rejected with that step. Interactions with a trail that has changed since the browser last rendered it are ignored, so a stale click cannot decide the wrong step.
ShowActions controls visibility only; it is not an authorization check. Validate permissions in the handlers.
Comments
While ShowComments is true (the default), every non-empty Comment is listed under the chain together with the participant's name. Clicking a comment raises CommentClick; clicking a portrait raises StepClick. Comments are plain text, and markup is displayed literally.
Orientation
Orientation lays the chain out horizontally (the default), with the participants side by side, or vertically, with each participant on its own row, which suits a narrow side panel.
Localized Texts
ApproveText and RejectText override the button captions, and ApprovedText, PendingText, WaitingText, RejectedText and SkippedText override the state captions. Leave them null to use the built-in translations for the current UI culture.
How To
Show the Approvals of a Purchase Request
this.approvalTrail1.Steps.Add(new ApprovalStep
{
Text = "Nadia Ferrari", SubText = "Team lead",
State = ApprovalState.Approved, Date = new DateTime(2026, 11, 28, 10, 15, 0)
});
this.approvalTrail1.Steps.Add(new ApprovalStep
{
Text = "Marcus Chen", SubText = "Finance",
State = ApprovalState.Approved, Date = new DateTime(2026, 11, 29, 16, 2, 0),
Comment = "Within the Q4 hardware budget."
});
this.approvalTrail1.Steps.Add(new ApprovalStep
{
Text = "Leila Costa", SubText = "CFO", State = ApprovalState.Pending
});
this.approvalTrail1.Steps.Add(new ApprovalStep
{
Text = "Procurement", SubText = "Purchase order", State = ApprovalState.Waiting
});
Record a Decision
ApprovalEventArgs carries the Step the decision is for and its Index.
private void approvalTrail1_Approved(object sender, ApprovalEventArgs e)
{
if (!this.currentUser.CanApprove(this.request, e.Step.Text))
{
AlertBox.Show("You are not the approver for this step.", MessageBoxIcon.Warning);
return;
}
this.requestService.RecordDecision(this.request.Id, e.Index, approved: true);
e.Step.State = ApprovalState.Approved;
e.Step.Date = DateTime.Now;
// Hand the request to the next participant.
if (e.Index + 1 < this.approvalTrail1.Steps.Count)
this.approvalTrail1.Steps[e.Index + 1].State = ApprovalState.Pending;
}
Collect a Reason When Rejecting
private void approvalTrail1_Rejected(object sender, ApprovalEventArgs e)
{
var reason = this.textBoxReason.Text.Trim();
if (reason.Length == 0)
{
AlertBox.Show("Enter a reason for the rejection.");
return;
}
this.requestService.RecordDecision(this.request.Id, e.Index, approved: false, reason: reason);
e.Step.State = ApprovalState.Rejected;
e.Step.Date = DateTime.Now;
e.Step.Comment = reason;
}
Advanced
JavaScript Widget
| Item | Description |
|---|---|
| Class name | "wisej.web.ApprovalTrail" |
| Theme appearance | "approvaltrail", with the components "scroll", "portrait", "title", "subtext", "status", "comment", "actions", "approve" and "reject"; the portrait and the status take the state of the step ("approved", "pending", "waiting", "rejected", "skipped"). See Themes. |