Hi,
I have a trouble in displaying data in the XamdataGrid.The code shown below does not display any data in the grid.Can you please help me?
//xaml part
<my:XamDataGrid Grid.Column="1" Margin="0,6,12,12" Name="xamDataGrid1" FieldLayoutInitialized="FieldLayOut_CaseJournel" Grid.Row="1" >
<my:XamDataGrid.FieldLayoutSettings>
<my:FieldLayoutSettings AutoGenerateFields="False"></my:FieldLayoutSettings>
</my:XamDataGrid.FieldLayoutSettings>
</my:XamDataGrid>
//C# .NET
private void GridDisplay(string s )
{
da = new OracleDataAdapter(s,conn);
ds = new DataSet();
da.Fill(ds);
xamDataGrid1.DataSource = ds.Tables[0].DefaultView;
}
private void OnWindowload(object sender, RoutedEventArgs e)
OpenOracleConnection();
string sql = "Select case.File_nr,court.court_name " +
"from case_journal,case,court,cstmr " +
"where case_journal.case_id=case.case_id " +
"AND case.court_id=court.court_id " +
"AND case.cstmr_id=cstmr.cstmr_id ";
GridDisplay(sql);
private void FieldLayOut_CaseJournel(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs FieldEvent)
Field FileNo = new Field();
FileNo.Name = "File_nr";
FileNo.Label = "File Number";
Field CourtName = new Field();
CourtName.Name = "court_name";
CourtName.Label = "Court Name";
FieldEvent.FieldLayout.Fields.Add(FileNo);
FieldEvent.FieldLayout.Fields.Add(CourtName);
Regards,
Shiffy
The data is displayed by setting AutoGenerateFields = true,but when it is false only the field names are displayed and there is no data.I also tried the same giving another query but the result was the same.
Hello Shiffy,
The XamDataGrid will require all public properties (or DataTable columns) to be added in the FieldLayout. It is possible that your XDG's datasource fields do not match the ones that you manually add. Tru setting the AutoGenerateFields to true and see what colunms the XDG generates automatically and then turn it off and generate the same manually.