In my project, I create a Datatable tag ass below picture
I want to add data ino this table by code behind. The code is below
In the Draw, I used datagrid window to show the this table and 2 other to count the row and column of table.
The code behind didn’t have any error.
But when runtime, No data is added into table when i run code behind.
I don’t know where is my problem.
Please support me.
There are various methods to populate a DataTable Tag in CodeBehind. One approach involves creating a DataTable class variable, adding rows and columns to it, and then assigning the variable to the Tag.
Please find below a code snippet that demonstrates the process. In this example, we create a DataTable object called “Table1” and add two columns (“Name” and “Age”) to it. Next, we create a DataRow object named “row1” and assign values to the “Name” and “Age” columns of that row. Finally, we add the row to the Table1 DataTable, and the @Tag.Table1 is assigned the Table1 object:
DataTable Table1 = new DataTable();
DataColumn Name = new DataColumn();
DataColumn Age = new DataColumn();
Name.ColumnName = "Name";
Age.ColumnName = "Age";
DataRow row1 = Table1.NewRow();
row1["Name"] = "Hung";
row1["Age"] = "25";
@Tag.row_count = Table1.Rows.Count;
@tag.column_count = Table1.Columns.Count;
@Tag.Table1 = Table1;
You can achieve similar results using Queries or by modifying the DataGrid itself. Please let us know if you require further assistance in those areas.
Thank for your feedback.
I mean that. Can I add co;umns, row into datatable tag instead of Datatable class as below.
On the code section we sent you, the rows and columns are being added to the DataTable Tag, the way we do that, is by adding the desired data to a DataTable variable on CodeBehind, and on the last line of the code (@Tag.Table1=Table1;) we assigned the DataTable class variable to the DataTable Tag.
This way, all the columns and rows added in the code are going to the DataTable Tag.
Please let us know if you still have any questions regarding Datatable Tags.
Thank for your Feedback.
As I share. In My project I want to work directly with Datatable Tag ( without Datatable Class Varriable).
I create a Script in code behind with no error when complie. But when runtime, i monitored via trace window. The error was shown.
Please see below pictures
Currently, on FactoryStudio, the “Value” and “DisplayValue” properties cannot be used to add rows and columns directly to the DataTable tag. In order to achieve what you want, it is necessary to use a DataTable class variable and assign it to the Tag after adding the rows and columns.