1. method:
Public void DetaGrid_bookcate_ItemCommand (object sender, DataGridCommandEventArgs e)
...{
// This event fires prior to all of the other commands
// Use it to provide a more graceful transition out of edit mode
DetailCheckIsEditing (e. CommandName );
}
Public void DetailCheckIsEditing (string commandName)
...{
If (detated_bookcate.edititemindex! =-1)
...{
// We are currently editing a row
If (commandname! = "Cancel" & commandname! = "Update ")
...{
// User's edit changes (if any) will not be committed
// Message. InnerHtml = "when selecting another current entry, save or cancel the modification to the current entry first! ";
IsEditing = true;
}
}
}
2. method:
Protected void datagrid_orderinfo_itemcommand (Object source, datagridcommandeventargs E)
...{
If (E. commandname = "memo ")
...{
// Obtain the index of the selected item in the control
This. Maid = E. Item. itemindex;
If (datagrid_orderinfo.selectedindex =-1)
...{
This. OrdersDetail. Visible = true;
Memo = this.txt Memo. Text. Trim ();
IsDel = this. chkIsDel. Checked. ToString ();
Datetimed = Convert.ToDateTime(this.txt DateTimed. Text. Trim ());
Customerid = convert.toint32(this.txt customerid. Text. Trim ());
Shipdate = convert.todatetime(this.txt shipdated. Text. Trim ());
Hasview = This. chkhasview. Checked. tostring ();
Hascheck = This. chkhascheck. Checked. tostring ();
Hassend = This. chkhassend. Checked. tostring ();
Hasreceive = This. chkhasreceive. Checked. tostring ();
Adminpub. spdatagrid_orderinfo_itemcommand (memo, isdel, datetimed, customerid, shipdate, hasview, hascheck, hassend, hasreceive );
Int cartid = convert. toint32 (request. Params ["cartid"]. tostring ());
Int productid = convert. toint32 (request. Params ["productid"]. tostring ());
// Display items in the shopping cart
BindDatagrid_ShoppingCart (CartId, ProductId );
}
Else
...{
Response. Write ("<script language = javascript> alert ('register as a formal member ') </script> ");
}
}
}
If the Code does not contain DataGrid_CannelCommand () and DataGrid_UpdateCommand (), the second method is used.