// Create handler delegate private void dgOrderConfirm_ItemCreated (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { CheckBox cb = (CheckBox) e.Item.FindControl ( "cbselect"); cb.CheckedChanged = new System.EventHandler (this.cbselectChanged);}} // Create event private void cbselectChanged (object sender, System.EventArgs e) { Checkbox CB = (Checkbox) Sender; DataGridItem Li = (DataGridItem) cb.parent.parent;
IF (cb.checked == true) {li.cells [8] .text = string.format ("{0: f2}", float.parse (li.cells [7] .text) * (Float.Parse .. ((TextBox) li.FindControl ( "tbdiscount")) Text))) ToString (); this.lbgetsum.Text = string.Format ( "{0: F2}", (float.Parse (this.lbgetsum. . Text) float.Parse (li.Cells [8] .Text))) ToString ();} else {this.lbgetsum.Text = string.Format ( "{0: F2}", (float.Parse (this .lbgetsum.Text) -float.Parse (li.Cells [8] .Text))) ToString ();. li.Cells [8] .Text = "";}} // traverse datagridforeach (DataGridItem dgi in DataGrid1. Items) {IF ((CheckBox) DGI.FindControl ("CBSELECT")). CheckBox Dgi.FindControl ("cbBack")). Checked) {response.write (String.Format ("< Script language = 'javascript'> Alert (/ "You cannot collect /"); script> ")); Return;}}