One way to do this is by breaking up the parent table into a list of DataTables (or my preference, BindingList<DataTable>
) and then assigning the grid's DataSource on the position change of the navigator control:
BindingSource bs = new BindingSource();
BindingList<DataTable> tables = new BindingList<DataTable>();
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
int counter = 0;
DataTable dt = null;
foreach (DataRow dr in tblTicketDetail.Rows) {
if (counter == 0) {
dt = tblTicketDetail.Clone();
tables.Add(dt);
}
dt.Rows.Add(dr.ItemArray);
++counter;
if (counter > 9) {
counter = 0;
}
}
bindingNavigator1.BindingSource = bs;
bs.DataSource = tables;
bs.PositionChanged += bs_PositionChanged;
bs_PositionChanged(bs, EventArgs.Empty);
}
void bs_PositionChanged(object sender, EventArgs e) {
dataGridView1.DataSource = tables[bs.Position];
}
As far as centering the BindingNavigator control, just set the Dock style to None and position the control in the center manually. Once set, set the Anchors to none and the ToolBar should "float" in the center when the container is resized.