I have a form showing the details of a client (various controls), along with their orders (in a DataGridView).
I am trying to add a ComboBox to let the user select one of the client's orders and display the items associated with it in a separate DataGridView.
However, I cannot work out which DataSource/DataBindings I need for either the ComboBox or the items DataGridView - please can anyone give me a few pointers?
Orders will be the data-source for the ComboBox - OrderId will be the Value field while Order Number or Order Date will be the text field. Items for that order will be data source for the items DataGridView. This grid needs to be bound in the combo-box's selection change event (set auto postback true for the combo box). Hope this helps. Psuedo code for selection change event would be
protected void Orders_SelectedIndexChanged(object sender, EventArgs e)
{
var orderId = int.Parse(Orders.SelectedValue);
// Get items for this order from data store
var items = ...
// Bind with items grid
OrderItems.DataSource = items;
OrderItems.DataBind();
}
Orders is name of combo-box having orders while OrderItems is gridview to display items.