Parent Child data in multiple datagrids

Discussion in 'ASP .Net Datagrid Control' started by Crash, Aug 11, 2004.

  1. Crash

    Crash Guest

    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();
    }
    Crash, Aug 11, 2004
    #1
    1. Advertising

  2. Crash

    Crash Guest

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

    what am I not understanding?
    "Crash" wrote in message news:...
    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();
    }
    Crash, Aug 11, 2004
    #2
    1. Advertising

  3. Crash

    Crash Guest

    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 news:eLJ03%...
    I have tried adding BoundColumns with the DataField value set to the column name in the DataRow[]

    what am I not understanding?
    "Crash" wrote in message news:...
    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();
    }
    Crash, Aug 11, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    0
    Views:
    316
    Kathy Burke
    Aug 26, 2003
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,119
    David Schwartz
    Dec 9, 2003
  3. Danny Sikora

    "parent / child" datagrids

    Danny Sikora, Feb 11, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    166
  4. Noel Dolan
    Replies:
    0
    Views:
    230
    Noel Dolan
    Jul 18, 2004
  5. Bitswapper
    Replies:
    5
    Views:
    140
    Prasad, Ramit
    Aug 27, 2013
Loading...

Share This Page