Class MultiSwapViewResult
- Namespace
 - Htmx.Components.ViewResults
 
- Assembly
 - Htmx.Components.dll
 
Returns multple htmx views within a single response
public class MultiSwapViewResult : IActionResult
  - Inheritance
 - 
      
      MultiSwapViewResult
 
- Implements
 
- Inherited Members
 
- Extension Methods
 
Constructors
MultiSwapViewResult()
Initializes a new instance of the MultiSwapViewResult class.
public MultiSwapViewResult()
  MultiSwapViewResult((string PartialView, object Model)?, params HtmxViewInfo[])
Initializes a new instance of the MultiSwapViewResult class with optional main content and out-of-band views.
protected MultiSwapViewResult((string PartialView, object Model)? main = null, params HtmxViewInfo[] oobs)
  Parameters
main(string PartialView, object Model)?A tuple containing the partial view name and model for the main content, or null if no main content.
oobsHtmxViewInfo[]An array of out-of-band view information objects.
Properties
Model
Gets or sets the original model that may be needed for further processing such as in result filters.
[JsonIgnore]
public object? Model { get; set; }
  Property Value
Methods
ExecuteResultAsync(ActionContext)
Executes the result operation, rendering all main and out-of-band views into the HTTP response.
public Task ExecuteResultAsync(ActionContext context)
  Parameters
contextActionContextThe action context in which the result is executed.
Returns
- Task
 A task that represents the asynchronous execution operation.
WithMainContent(string, object)
Sets the main content for the response using the specified view name and model.
public MultiSwapViewResult WithMainContent(string viewName, object model)
  Parameters
viewNamestringThe name of the view to render as main content.
modelobjectThe model to pass to the view.
Returns
- MultiSwapViewResult
 The current MultiSwapViewResult instance for method chaining.
WithOobContent(HtmxViewInfo)
Adds a single out-of-band content item to the response.
public MultiSwapViewResult WithOobContent(HtmxViewInfo oob)
  Parameters
oobHtmxViewInfoThe HtmxViewInfo object representing the out-of-band content to add.
Returns
- MultiSwapViewResult
 The current MultiSwapViewResult instance for method chaining.
WithOobContent(IEnumerable<HtmxViewInfo>)
Adds multiple out-of-band content items to the response.
public MultiSwapViewResult WithOobContent(IEnumerable<HtmxViewInfo> oobList)
  Parameters
oobListIEnumerable<HtmxViewInfo>A collection of HtmxViewInfo objects representing the out-of-band content to add.
Returns
- MultiSwapViewResult
 The current MultiSwapViewResult instance for method chaining.
WithOobContent(string, object)
Adds out-of-band content to the response, automatically determining targeting options from the model if it implements IOobTargetable.
public MultiSwapViewResult WithOobContent(string viewName, object model)
  Parameters
viewNamestringThe name of the view to render as out-of-band content.
modelobjectThe model to pass to the view. If the model implements IOobTargetable, its targeting properties will be used.
Returns
- MultiSwapViewResult
 The current MultiSwapViewResult instance for method chaining.
WithOobContent(string, object, OobTargetDisposition, string?)
Adds out-of-band content to the response with specified targeting options.
public MultiSwapViewResult WithOobContent(string viewName, object model, OobTargetDisposition targetDisposition = OobTargetDisposition.OuterHtml, string? targetSelector = null)
  Parameters
viewNamestringThe name of the view to render as out-of-band content.
modelobjectThe model to pass to the view.
targetDispositionOobTargetDispositionThe disposition that determines how the content should be swapped (default is OuterHtml).
targetSelectorstringAn optional CSS selector to target a specific element for the swap.
Returns
- MultiSwapViewResult
 The current MultiSwapViewResult instance for method chaining.