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(); } } }
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()); }
private void BindUserList() { //MRPClass.PrintString("MRP is bind"); DataTable dtRecord = AccountClass.UserList(); UserListGrid.DataSource = dtRecord; UserListGrid.KeyFieldName = "PK"; UserListGrid.DataBind(); }
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; }
protected void BUCallBackPanel_Callback(object sender, CallbackEventArgsBase e) { ASPxPageControl pageControl = UserListGrid.FindEditFormTemplateControl("UserPageControl") as ASPxPageControl; ASPxComboBox entCode = pageControl.FindControl("EntityCode") as ASPxComboBox; ASPxCallbackPanel callBackPanel = pageControl.FindControl("BUCallBackPanel") as ASPxCallbackPanel; ASPxComboBox buCode = callBackPanel.FindControl("BUCode") as ASPxComboBox; buCode.Value = ""; buCode.Text = ""; DataTable dtRecord = GlobalClass.EntBUSSUTable(entCode.Value.ToString()); buCode.DataSource = dtRecord; buCode.TextField = "NAME"; buCode.ValueField = "ID"; buCode.TextFormatString = "{1}"; buCode.DataBind(); }