Parent Child data in multiple datagrids

C

Crash

I bet this is simple for those who have worked with the datagrid for while,

I have a parent grid and a few child grids, i want to bind the children so when i click on the parent the children update appropriately, so I thought I could do this. But the child grids appear to have the right row count, but no data is shown, just the RowError and HasErrors columns (which indicate no error) but the right number of rows are there so i know the data is behind it somewhere, its just not displaying... why not?

thanks...

private void SchedulesGrid_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(SchedulesGrid.SelectedIndex != -1)
{
DataRow parentRow = myData.Tables[0].Rows[SchedulesGrid.SelectedIndex];
//update child grids
TimesGrid.DataSource = parentRow.GetChildRows(relScheduleToTimes);
TimesGrid.DataBind();

ExclusionDatesGrid.DataSource = parentRow.GetChildRows(relScheduleToExclusionDates);
ExclusionDatesGrid.DataBind();

DayOfWeekGrid.DataSource = parentRow.GetChildRows(relScheduleToDays);
DayOfWeekGrid.DataBind();

MonthsGrid.DataSource = parentRow.GetChildRows(relScheduleToMonths);
MonthsGrid.DataBind();

DayOfMonthGrid.DataSource = parentRow.GetChildRows(relScheduleToMonthDays);
DayOfMonthGrid.DataBind();
}
 
C

Crash

I have tried adding BoundColumns with the DataField value set to the column name in the DataRow[]

what am I not understanding?
in message I bet this is simple for those who have worked with the datagrid for while,

I have a parent grid and a few child grids, i want to bind the children so when i click on the parent the children update appropriately, so I thought I could do this. But the child grids appear to have the right row count, but no data is shown, just the RowError and HasErrors columns (which indicate no error) but the right number of rows are there so i know the data is behind it somewhere, its just not displaying... why not?

thanks...

private void SchedulesGrid_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(SchedulesGrid.SelectedIndex != -1)
{
DataRow parentRow = myData.Tables[0].Rows[SchedulesGrid.SelectedIndex];
//update child grids
TimesGrid.DataSource = parentRow.GetChildRows(relScheduleToTimes);
TimesGrid.DataBind();

ExclusionDatesGrid.DataSource = parentRow.GetChildRows(relScheduleToExclusionDates);
ExclusionDatesGrid.DataBind();

DayOfWeekGrid.DataSource = parentRow.GetChildRows(relScheduleToDays);
DayOfWeekGrid.DataBind();

MonthsGrid.DataSource = parentRow.GetChildRows(relScheduleToMonths);
MonthsGrid.DataBind();

DayOfMonthGrid.DataSource = parentRow.GetChildRows(relScheduleToMonthDays);
DayOfMonthGrid.DataBind();
}
 
C

Crash

I have seen code examples where the DataRow[] is turned into a DataTable then bound using DataTable.DefaultView... is this the way its supposed to be done?
"Crash" wrote in message I have tried adding BoundColumns with the DataField value set to the column name in the DataRow[]

what am I not understanding?
in message I bet this is simple for those who have worked with the datagrid for while,

I have a parent grid and a few child grids, i want to bind the children so when i click on the parent the children update appropriately, so I thought I could do this. But the child grids appear to have the right row count, but no data is shown, just the RowError and HasErrors columns (which indicate no error) but the right number of rows are there so i know the data is behind it somewhere, its just not displaying... why not?

thanks...

private void SchedulesGrid_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(SchedulesGrid.SelectedIndex != -1)
{
DataRow parentRow = myData.Tables[0].Rows[SchedulesGrid.SelectedIndex];
//update child grids
TimesGrid.DataSource = parentRow.GetChildRows(relScheduleToTimes);
TimesGrid.DataBind();

ExclusionDatesGrid.DataSource = parentRow.GetChildRows(relScheduleToExclusionDates);
ExclusionDatesGrid.DataBind();

DayOfWeekGrid.DataSource = parentRow.GetChildRows(relScheduleToDays);
DayOfWeekGrid.DataBind();

MonthsGrid.DataSource = parentRow.GetChildRows(relScheduleToMonths);
MonthsGrid.DataBind();

DayOfMonthGrid.DataSource = parentRow.GetChildRows(relScheduleToMonthDays);
DayOfMonthGrid.DataBind();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,085
Latest member
cryptooseoagencies

Latest Threads

Top