Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Creating Bindable Grids of Data row["quantity"]= defaultQuantity; row["productname"] = tableRow["productname"]; row["price"] = (decimal) (defaultQuantity * Convert.ToDecimal(tableRow["unitprice"])); m_cart.Rows.Add(row); 234 } The DataGridItem object that gets passed to AddToCart is the e.Item object taken from the event data: void ItemCommand(object sender, DataGridCommandEventArgs e) { // Command names ARE case-sensitive switch(e.CommandName) { case "AddToCart": AddToCart(e.Item, e.Item.ItemIndex); break; } } DataGrid In-Place Editing A DataGrid control displays mostly read-only data. If editing is needed, you select the row to update and post a request for another page. The new page contains an edit form with input fields and links to persist or reject the changes. This is probably the most effective pattern for editing data over the Web and certainly the pattern that provides the highest level of flexibility. With DataGrid controls, though, another simpler, but just as effective, model of data editing is possible. The new model is known as in-place editing and mimics the behavior of an Excel worksheet. When you trigger the