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
Try hooking to XamDataGrid’s Load event and move your code here:
private void xamDataGrid1_Loaded(object sender, RoutedEventArgs e)
xamDataGrid1.FieldLayouts.Clear();
FieldLayout fl = new FieldLayout();
CourtName.Name = "Court_name";
fl.Fields.Add(FileNo);
fl.Fields.Add(CourtName);
xamDataGrid1.FieldLayouts.Add(fl);
Thanks,
-Slavi