IDataStore.GetChild(string name) Method
.NET Standard 2.x
Provides a reference to the DataWindowChild
, which you can use to manipulate that DataStore.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public IDataStore GetChild(string name);
Parameters
name
System.String
A string which is the name of the column containing the DataWindowChild
.
Returns
The reference to the DataWindowChild
.
Remarks
A DataWindowChild
object is a DropDownDataWindow within a DataWindow
object.
Use the GetChild
method when you need to explicitly retrieve data for a DataWindowChild
object. It automatically retrieves data for the child when retrieving the main DataStore, you need to explicitly retrieve data when there are retrieval arguments or when conditions change and you want to retrieve new rows.
Examples
The following code example demonstrates how to get the DataWindowChild
in the specified column.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class GetChildExample
{
private readonly SchoolContext _context;
public GetChildExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example1()
{
// Instantiates a DataStore object with datawindow: d_course.
var datastore = new DataStore("d_course", _context);
datastore.Retrieve();
// The departmentid column has a DropDownDataWindow: dddw_deparment.
var department = datastore.GetChild("departmentid");
Console.WriteLine("DataWindowChild rowcount: {0}",
department.RowCount);
Console.WriteLine(
"Department ID: {0}; Department Name: {1}",
department.GetItem<int>(1, "departmentid"),
department.GetItem<string>(1, "name"));
/*This code produces the following output:
DataWindowChild rowcount: 4
Department ID: 2; Department Name: English
*/
}
}
}
Example Refer To
Model Classes: D_Course Dddw_Department
DataWindow File: d_course
Applies to
.NET Standard
2.x