Home Forums WinForms controls Xceed Grid for WinForms Displaying record on the detail grid.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13433 |

    I’m trying to add the rows dynamically using .DataRows.AddNew() method.The same piece of code is added to both Master and child grids. The Master grid displays record however the child grid doesn’t display the record. However if i bind using datatable the Detail/Child grid gets filled

    public void AddControls()
    {
    DataRow dr;
    Xceed.Grid.Licenser.LicenseKey = “<MY LICENSE KEY GOES HERE>”;
    GridControl grdControl = new GridControl();
    grdControl.FixedHeaderRows.Add( new ColumnManagerRow());
    grdControl.Columns.Add(new Column(“Field1”));
    grdControl.Columns.Add(new Column(“Field2”));
    dr = grdControl.DataRows.AddNew();
    grdControl.BeginInit();
    dr.BeginEdit();
    dr.Cells[0].Value = “One”;
    dr.Cells[1].Value = “two”;
    dr.EndEdit();

    //Adding the control to the form
    this.Controls.Add(grdControl);
    DetailGrid childDetail = new DetailGrid();
    childDetail.HeaderRows.Add( new ColumnManagerRow() );
    childDetail.Columns.Add(new Column(“Title”));
    childDetail.BeginInit();
    //Creating a datarow for the child grid
    Xceed.Grid.DataRow datRow = childDetail.DataRows.AddNew();
    //Editing the row
    datRow.BeginEdit();
    //Setting the value to the cell
    datRow.Cells[“Title”].Value = “Mr”;
    //Complete the datarow edit operation
    datRow.EndEdit();
    childDetail.Collapsed = true;

    grdControl.DetailGridTemplates.Add( childDetail );
    childDetail.EndInit();
    grdControl.EndInit();

    }

    The above code adds data only to the master grid not to the childdetail.. Any pointers would be of great help

    Imported from legacy forums. Posted by Prakashsha (had 2164 views)

    User (Old forums)
    Member
    Post count: 23064

    I have the same problem

    Imported from legacy forums. Posted by Creat (had 2836 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.