1.method:

来源:互联网 发布:数据库系统的组成包括 编辑:程序博客网 时间:2024/05/21 06:52
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() 时就采用第二种方法。