Problems using DataGrid with T4A

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
Post Reply
pmanuel
Posts: 8
Joined: Fri Aug 30, 2013 10:49 am

Problems using DataGrid with T4A

Post by pmanuel »

Hello to all.

I'm experiencing some problems using datagrid object (Target: T4A; iX version: 2.0).

When in simulation mode, the Datagrid shows filled as in the picture (OK)
ok.png
ok.png (32.15 KiB) Viewed 10465 times
When running in the target, with exactly the same (just for example) code, the Datagrid apears empty as bellow (screenshot)
scrnHistorico 21-04-2014 20.34.22.png
scrnHistorico 21-04-2014 20.34.22.png (5.1 KiB) Viewed 10465 times
Code used:

void btExport_Click(System.Object sender, System.EventArgs e)
{

/*scptDatabaseTools dbTools=new scptDatabaseTools();
DataSet dsOrig=dbTools.GetResultSet("ResultadosTesteLogger");*/
DataSet ds=new DataSet();

//MessageBox.Show(""+dbTools.GetCSVHeader(ds.Tables[0].Columns));
//MessageBox.Show(""+dbTools.GetCSVRow(ds.Tables[0].Rows[0]));

//Just for debug
DataTable dataTbl = new DataTable("Teste");
dataTbl.Columns.Add("Hello1", System.Type.GetType("System.String"));
dataTbl.Columns.Add("Hello2", System.Type.GetType("System.String"));
ds.Tables.Add(dataTbl);
DataGrid1.DataSource=ds.DefaultViewManager;
//Just for debug

}

Can you please tell me what am I doing wrong?

Thanks in advance.

stuartm
Posts: 61
Joined: Thu Jun 06, 2013 9:21 am

Re: Problems using DataGrid with T4A

Post by stuartm »

Looks like you need to manually create the datarow. It is possible iterate over an IEnumerable<T> implementation insert every row.

Code: Select all

DataSet ds=new DataSet();

DataTable dataTbl = new DataTable("Teste");
dataTbl.Columns.Add("Hello1", typeof(string));
dataTbl.Columns.Add("Hello2", typeof(string));
			
DataRow row = dataTbl.NewRow();
row["Hello1"] = "World1";
row["Hello2"] = "World2";
dataTbl.Rows.Add(row);
			
ds.Tables.Add(dataTbl);

DataGrid.DataSource = ds.DefaultViewManager;
Best Regards,
Stuart
Attachments
DataGrid.png
DataGrid.png (40.72 KiB) Viewed 10451 times

pmanuel
Posts: 8
Joined: Fri Aug 30, 2013 10:49 am

Re: Problems using DataGrid with T4A

Post by pmanuel »

Hello Stuart.

I already tested your code. The same symptoms. The problem is not related with the fact that the datagrid has no added rows. I think you understood that the problem was with the null values on rows... The problem is that when I download the project to the physical target (T4A) the datagrid appears empty. Exactly the same code running: in simulation mode datagrid filled; on target: datagrid empty (as in the pictures I sent).

Thanks by your reply.

User avatar
Edmund
Posts: 92
Joined: Thu Nov 29, 2012 2:27 pm

Re: Problems using DataGrid with T4A

Post by Edmund »

Try use a Listview instead (it works in runtime).

Set the columns and bindings in the Xaml and load the data into it via ItemsSource.
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group

pmanuel
Posts: 8
Joined: Fri Aug 30, 2013 10:49 am

Re: Problems using DataGrid with T4A

Post by pmanuel »

Hello Edmond.

I tryed to modify the XAML file following the example given by you on post

http://beijerinc.com/support/ix/forum/v ... 66d2#p3736

but i can´t get it to work. Always get a XAML error message and I can´t find more information (probably a XAML syntax error) to try to solve the problem.

My XAML portion of code refering to the ListView:

<nacn:NeoWindowsFormsHost Background="#FFFFFFFF" Name="ListView1" Width="252" Height="182" RenderTransformOrigin="0.5,0.5" Visibility="Visible" Panel.ZIndex="10" Canvas.Left="208" Canvas.Top="34">
<nacn:NeoWindowsFormsHost.Control>
<swf:ListView Text="ListView" Enabled="True" Font="Microsoft Sans Serif, 8.25pt" Location="0, 0" Name="ListView1_ListView" Size="252, 182" TabIndex="0" />
</nacn:NeoWindowsFormsHost.Control>
</nacn:NeoWindowsFormsHost>

Can you give me an example how to do columns and bindings?

Thanks

stuartm
Posts: 61
Joined: Thu Jun 06, 2013 9:21 am

Re: Problems using DataGrid with T4A

Post by stuartm »

Try this application out. I found a Datagrid example from way back. It was useless for me trying to build an app from MSDN since most the of the Datagrid examples are written not for CE and will not work. I'm sure both can be used however I don't have weeks of free time making old technology new.

The application queries the sql database and creates a GridView. The developer can control what values are displayed programmatically.
Attachments
SET THIS FIRST!!!.JPG
SET THIS FIRST!!!.JPG (122.43 KiB) Viewed 10426 times
Script_Database_Adjustable_Columns.zip
(200.75 KiB) Downloaded 683 times

User avatar
Edmund
Posts: 92
Joined: Thu Nov 29, 2012 2:27 pm

Re: Problems using DataGrid with T4A

Post by Edmund »

pmanuel wrote:Hello Edmond.

I tryed to modify the XAML file following the example given by you on post

http://beijerinc.com/support/ix/forum/v ... 66d2#p3736

but i can´t get it to work. Always get a XAML error message and I can´t find more information (probably a XAML syntax error) to try to solve the problem.

My XAML portion of code refering to the ListView:

<nacn:NeoWindowsFormsHost Background="#FFFFFFFF" Name="ListView1" Width="252" Height="182" RenderTransformOrigin="0.5,0.5" Visibility="Visible" Panel.ZIndex="10" Canvas.Left="208" Canvas.Top="34">
<nacn:NeoWindowsFormsHost.Control>
<swf:ListView Text="ListView" Enabled="True" Font="Microsoft Sans Serif, 8.25pt" Location="0, 0" Name="ListView1_ListView" Size="252, 182" TabIndex="0" />
</nacn:NeoWindowsFormsHost.Control>
</nacn:NeoWindowsFormsHost>

Can you give me an example how to do columns and bindings?

Thanks

Hi pmanuel!

I´m really sorry, I don´t know what I was thinking about when I posted this... I was thinking your target was a computer (TxC, full framework)... My suggest will not work for you....

Once again, sorry.
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group

Post Reply