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 (DetaGrid_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 = "在选择另一条目前,请先保存或取消对当前条目的修改!";
isEditing = true;
}
}
}

2.method:
protected void DataGrid_OrderInfo_ItemCommand(object source, DataGridCommandEventArgs e)
...{
if (e.CommandName == "Memo")
...{
//获取控件中的选定项的索引
this.DataGrid_OrderInfo.SelectedIndex = e.Item.ItemIndex;
if(DataGrid_OrderInfo.SelectedIndex == -1)
...{
this.OrdersDetail.Visible = true;
Memo = this.txtMemo.Text.Trim();
IsDel = this.chkIsDel.Checked.ToString();
Datetimed = Convert.ToDateTime(this.txtDateTimed.Text.Trim());
CustomerId = Convert.ToInt32(this.txtCustomerId.Text.Trim());
ShipDate = Convert.ToDateTime(this.txtshipDated.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());
//展示购物车中的商品
BindDatagrid_ShoppingCart(CartId, ProductId);


}
else
...{
Response.Write("<script language=javascript>alert('请注册为正式会员才行')</script>");
}
}

}
如果没有在代码中没有DataGrid_CannelCommand() and DataGrid_UpdateCommand() 时就采用第二种方法。


被折叠的 条评论
为什么被折叠?



