public void FocusAndExpandToNode(DevExpress.Web.ASPxTreeList.TreeListNode node)
 {
     node.Focus();
     node.Expanded = true;
     while (node.ParentNode != null)
     {
         node = node.ParentNode;
         node.Expanded = true;
     }
 }
        public bool CheckNullControl(DevExpress.XtraEditors.LookUpEdit pControl, string pLabelText)
        {
            pLabelText = pLabelText.Replace("(*)", "");

            if (pControl.EditValue == null || pControl.EditValue.ToString().Trim().Length == 0)
            {
                MessageBox.Show(this, "Vui lòng nhập " + pLabelText + "'", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                pControl.Focus();
                return false;
            }
            return true;
        }
Exemple #3
0
 //Check is Combo Present 
 public bool isDatePresent(DevExpress.XtraEditors.DateEdit DateEditor, string name)
 {
     if (string.IsNullOrEmpty(DateEditor.Text))
     {
         DevExpress.XtraEditors.XtraMessageBox.Show(name + " is a requierd field", "Entry error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         DateEditor.Focus();
         return false;
     }
     else
     {
         return true;
     }
 }
Exemple #4
0
 //Check is Combo Present 
 public bool isNumaricPresent(DevExpress.XtraEditors.CalcEdit combobox, string name)
 {
     if (string.IsNullOrEmpty(combobox.Text))
     {
         DevExpress.XtraEditors.XtraMessageBox.Show(name + " is a requierd field", "Entry error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         combobox.Focus();
         return false;
     }
     else
     {
         return true;
     }
 }
Exemple #5
0
 public static void SetAlertTextMemo(Control page, string msg, DevExpress.Web.ASPxEditors.ASPxMemo Memo, string key = "Validation")
 {
     ScriptManager.RegisterStartupScript(page, typeof(string), key, "alert('" + msg + "');", true);
     Memo.Focus();
 }
 private void focusFormsItem(object objMessageID, DevExpress.XtraEditors.BaseEdit xle)
 {
     UIMessage.ShowMessage(objMessageID, System.Windows.Forms.MessageBoxButtons.OK,
         System.Windows.Forms.MessageBoxIcon.Warning);
     xle.Focus();
 }
 public static bool moveTargetRow(DevExpress.XtraGrid.GridControl xgc,DataRow drTarget, string sKeyField)
 {
     try
     {
         DataView dv = null;
         if (xgc.DataSource is DataTable)
         {
             dv = ((DataTable)xgc.DataSource).DefaultView ;
         }
         else
             dv = (DataView)xgc.DataSource;
         DevExpress.XtraGrid.Views.Grid.GridView xgv = (DevExpress.XtraGrid.Views.Grid.GridView)xgc.DefaultView;
         int nRowHandle;
         for (nRowHandle = 0; nRowHandle < dv.Count; nRowHandle++)
         {
             DataRow drTemp = xgv.GetDataRow(nRowHandle);
             if (drTemp != null)
             {
                 if ( drTarget[sKeyField].Equals(drTemp[sKeyField]))
                 {
                     xgc.Focus();
                     xgv.ClearSelection();
                     xgv.FocusedRowHandle = nRowHandle;
                     xgv.SelectRow(nRowHandle);
                     return true;
                 }
             }
         }
         return false;
     }
     catch (Exception)
     {
         return false;
     }
 }
Exemple #8
0
 public static void SetAlertRadioButton(Control page, string msg, DevExpress.Web.ASPxEditors.ASPxRadioButton rd, string key = "Validation")
 {
     ScriptManager.RegisterStartupScript(page, typeof(string), key, "alert('" + msg + "');", true);
     rd.Focus();
 }
        //public static bool moveTargetGroup(DevExpress.XtraGrid.GridControl xgc,DataRow drTarget, string sKeyField)
        //{
        //    try
        //    {
        //        DataView dv = null;
        //        if (xgc.DataSource is DataTable)
        //        {
        //            dv = ((DataTable)xgc.DataSource).DefaultView ;
        //        }
        //        else
        //            dv = (DataView)xgc.DataSource;
        //        DevExpress.XtraGrid.Views.Grid.GridView xgv = (DevExpress.XtraGrid.Views.Grid.GridView)xgc.DefaultView;
        //        int nRowHandle = 0;
        //        // for (nRowHandle = 0; nRowHandle < dv.Count; nRowHandle++)
        //        while (nRowHandle < dv.Count)
        //        {
        //            if (!xgv.IsGroupRow(nRowHandle))
        //            {
        //                // get parent's row :
        //                int nParentRowHandle = xgv.GetParentRowHandle(nRowHandle);
        //                // get the number of child rows:
        //                int nChildRows = xgv.GetChildRowCount(nParentRowHandle);
        //                // get dislay value of group row :
        //                string sGroupDisplayValue = xgv.GetRowGroupDisplayText(nParentRowHandle);
        //                int nTokenPos = sGroupDisplayValue.IndexOf(":");
        //                sGroupDisplayValue = sGroupDisplayValue.Substring(nTokenPos+1,sGroupDisplayValue.Length - nTokenPos - 1).Trim();
        //                // compare :
        //                if (drTarget[sKeyField].ToString() == sGroupDisplayValue)
        //                {
        //                    xgc.Focus();
        //                    xgv.ClearSelection();
        //                    xgv.FocusedRowHandle = nParentRowHandle;
        //                    xgv.SelectRow(nParentRowHandle);
        //                    // expand all child rows :
        //                    xgv.SetRowExpanded(nParentRowHandle,true);
        //                    return true;
        //                }
        //                // move to child row of next group :
        //                nRowHandle = nRowHandle + nChildRows;
        //            }
        //        }
        //        return false;
        //    }
        //    catch (Exception)
        //    {
        //        return false;
        //    }
        //}
        public static void focusRowHandle(DevExpress.XtraGrid.GridControl xgc, int iFocusedRowHandle)
        {
            xgc.Focus();
            DevExpress.XtraGrid.Views.Grid.GridView xgv = (DevExpress.XtraGrid.Views.Grid.GridView)xgc.DefaultView;

            // clear old selection
            xgv.ClearSelection();
            // set focused:
            xgv.SelectRow(iFocusedRowHandle);
            xgv.FocusedRowHandle = iFocusedRowHandle;
        }
        public static bool deleteSelectedRow(DevExpress.XtraGrid.GridControl xgc,DevExpress.XtraGrid.Views.Grid.GridView xgv, object objMessageID)
        {
            if (xgv == null) return false;

            DataRow dr=null;
            try
            {
                dr = (DataRow)xgv.GetDataRow(xgv.FocusedRowHandle);
                if (dr != null)
                {
                    dr.Delete();
                }
                else
                {
                    UIMessage.ShowMessage(objMessageID ,System.Windows.Forms.MessageBoxButtons.OK,
                        System.Windows.Forms.MessageBoxIcon.Exclamation );
                    xgc.Focus();
                }
            }
            catch(Exception e)
            {
                throw new Exception(e.Message );
            }
            return true;
        }
Exemple #11
0
 //public static void SetAlertTextDate(Control page, string msg, DevExpress.Web.ASPxEditors.ASPxDateEdit txt, string key = "Validation")
 //{
 //    ScriptManager.RegisterStartupScript(page, typeof(string), key, "alert('" + msg + "');", true);
 //    txt.Focus();
 //}
 public static void SetAlertCheckbox(Control page, string msg, DevExpress.Web.ASPxEditors.ASPxCheckBox chk, string key = "Validation")
 {
     ScriptManager.RegisterStartupScript(page, typeof(string), key, "alert('" + msg + "');", true);
     chk.Focus();
 }
Exemple #12
0
 //SimpleButton
 public void PressEnter(KeyPressEventArgs e, DevExpress.XtraEditors.SimpleButton sb)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         e.Handled = true;
         sb.Focus();
     }
 }
Exemple #13
0
 //TextEdit
 public void PressEnter(KeyPressEventArgs e, DevExpress.XtraEditors.TextEdit txt)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         e.Handled = true;
         txt.Focus();
     }
 }