LoadDataFromModel Method
- Namespace
TXTextControl.Web
- Package
- None: the TX Text Control .NET Server setup installs it, for .NET Framework.
- Assembly
TXTextControl.Web. dll
Description
Loads a collection implementing interface System.Collections.IEnumerable as a data source.
Syntax
LoadDataFromModel(System.Collections.IEnumerable)
Interprets all public properties of the objects in the collection as possible table columns and / or child tables. The type of the first object in the collection is analyzed via .NET reflection and used as the basis of the assumed table structure. For more information about using object based data sources see DocumentServer.MailMerge.MergeObjects. The method returns immediately.
public void LoadDataFromModel(System.Collections.IEnumerable model);Public Sub LoadDataFromModel(model As System.Collections.IEnumerable)| Parameter | Description |
|---|---|
| model | Specifies a |
LoadDataFromModel(System.Collections.IEnumerable, System.IFormatProvider)
Allows to additionally specify a format which should be applied when converting date / time values and numerical values to strings.
public void LoadDataFromModel(System.Collections.IEnumerable model, System.IFormatProvider numberAndDateTimeFormat);Public Sub LoadDataFromModel(model As System.Collections.IEnumerable, numberAndDateTimeFormat As System.IFormatProvider)| Parameter | Description |
|---|---|
| model | Specifies a |
| numberAndDateTimeFormat | The format which should be applied when converting date / time values and numerical values to strings. |
Examples
LoadDataFromModel is not exposed by the current ASP.NET Core editor helper. The following example uses LoadDataFromModel in the current server-side setup instead.
var customers = new[]
{
new { CustomerName = "Contoso Ltd.", City = "Seattle" }
};
var configuredEditor = textControl.LoadDataFromModel(customers);
Console.WriteLine($"Configured editor: {configuredEditor.GetType().Name}");Dim customers = {
New With { .CustomerName = "Contoso Ltd.", .City = "Seattle" }
}
Dim configuredEditor = textControl.LoadDataFromModel(customers)
Console.WriteLine($"Configured editor: {configuredEditor.GetType().Name}")