Overview

This example show how to access TagProperties from CodeBehind.


Get DataRows method

The key for this is implementation is the method, which gets the the children from any folder as DataRow[], with each property in a column:

Get Tag Children
	DataTable table = new DataTable("Table1");
	table.Columns.Add("Name", typeof(string));
	table.Columns.Add("TypeName", typeof(string));

	// This call will get all tags from the root folder
	// In order to get tags from other folders, or domains, modify the paremeters of GetChildren Methods 
	DataRow[] rows =  TK.GetTagChildrenAsDataRow();
	
	// just fore verification
	int j = rows.Length;
	
	foreach (DataRow row in rows)
	{
		// In this example, we are getting only the Name and Type, all columns from UnsTas tables can be accessed using this method
		string name = TK.ToText(row["Name"]);		
		int type = TK.ToInt(row["Type"]);
		
	    string typeName = await TK.GetElementTypeAsync(name);		
		table.Rows.Add(name, typeName);		
	}//foreach
	

Solution Example

Download example: GetTagProperties.dblsn


  • No labels