示例#1
0
 protected void UserListGrid_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
 {
     if (e.ButtonID == "Edit")
     {
         if (UserListGrid.FocusedRowIndex > -1)
         {
             //Session["UserListKey"] = UserList.GetRowValues(UserList.FocusedRowIndex, "PK").ToString();
             //Response.RedirectLocation = "mrp_addedit.aspx";
             //sEntCode = sender.GetRowValues(e.VisibleIndex, "BUCode");
             //sEntCode = UserListGrid.GetRowValues(UserListGrid.FocusedRowIndex, "BUCode").ToString();
             //Session["UserListEntCode"] = UserListGrid.GetRowValues(UserListGrid.FocusedRowIndex, "BUCode").ToString();
             //System.Diagnostics.Debug.WriteLine("Edit Clicked : " + Session["UserListEntCode"].ToString());
         }
     }
     else if (e.ButtonID == "Delete")
     {
         if (UserListGrid.FocusedRowIndex > -1)
         {
             string        PK     = UserListGrid.GetRowValues(UserListGrid.FocusedRowIndex, "PK").ToString();
             string        delete = "DELETE FROM [dbo].[tbl_Users] WHERE [PK] ='" + PK + "'";
             SqlConnection conn   = new SqlConnection(GlobalClass.SQLConnString());
             conn.Open();
             SqlCommand cmd = new SqlCommand(delete, conn);
             cmd.ExecuteNonQuery();
             conn.Close();
             //BindMRP();
         }
     }
 }
示例#2
0
 protected void UserListGrid_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
 {
     bindUserList = false;
     //sEntCode = UserListGrid.GetRowValues(e.;
     sEntCode = UserListGrid.GetRowValues(UserListGrid.FocusedRowIndex, "EntityCode").ToString();
     sBUCode  = UserListGrid.GetRowValues(UserListGrid.FocusedRowIndex, "BUCode").ToString();
     //System.Diagnostics.Debug.WriteLine("Edit Clicked : " + sEntCode.ToString() + " / " + sBUCode.ToString());
 }
示例#3
0
        protected void UserListGrid_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string        PK     = UserListGrid.GetRowValues(UserListGrid.FocusedRowIndex, "PK").ToString();
            string        delete = "DELETE FROM [dbo].[tbl_Users] WHERE [PK] ='" + PK + "'";
            SqlConnection conn   = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();
            SqlCommand cmd = new SqlCommand(delete, conn);

            cmd.ExecuteNonQuery();
            conn.Close();

            BindUserList();

            e.Cancel = true;
        }