Exemplo n.º 1
0
        protected void gridListInvoice_DetailRowExpandedChanged(object sender, ASPxGridViewDetailRowEventArgs e)
        {
            //initialize control
            BootstrapGridView grid             = (BootstrapGridView)sender;
            BootstrapTextBox  txtInvoiceNumber = (BootstrapTextBox)grid.FindDetailRowTemplateControl(e.VisibleIndex, "txtInvoiceNumber");
            BootstrapTextBox  txtApproveBy     = (BootstrapTextBox)grid.FindDetailRowTemplateControl(e.VisibleIndex, "txtApproveBy");
            BootstrapDateEdit dateInvoice      = (BootstrapDateEdit)grid.FindDetailRowTemplateControl(e.VisibleIndex, "dateInvoice");
            BootstrapMemo     txtNote          = (BootstrapMemo)grid.FindDetailRowTemplateControl(e.VisibleIndex, "txtNote");

            //bind control
            if (txtInvoiceNumber == null)
            {
                return;
            }

            txtInvoiceNumber.Text = grid.GetRowValues(e.VisibleIndex, "InvoiceNumber").ToString();
            txtApproveBy.Text     = grid.GetRowValues(e.VisibleIndex, "ApproveBy") != null?grid.GetRowValues(e.VisibleIndex, "ApproveBy").ToString() : string.Empty;

            txtNote.Text = grid.GetRowValues(e.VisibleIndex, "Note") != null?grid.GetRowValues(e.VisibleIndex, "Note").ToString() : string.Empty;

            DateTime InvoiceDate = Convert.ToDateTime(grid.GetRowValues(e.VisibleIndex, "InvoiceDate"));

            if (InvoiceDate != DateTime.Parse("1/1/1900"))
            {
                dateInvoice.Value = InvoiceDate;
            }
            else
            {
                dateInvoice.Value = null;
            }
        }
Exemplo n.º 2
0
        protected void gridSPPB_SelectionChanged(object sender, EventArgs e)
        {
            BootstrapGridView grid = sender as BootstrapGridView;

            for (int i = 0; i < grid.VisibleRowCount; i++) // Loop through selected rows
            {
                if (grid.Selection.IsRowSelected(i))       // do whatever you need to do with selected row values
                {
                    // now use pre-initialized List<object> selectedList to save
                    string key    = grid.GetRowValues(i, "SPP_ID_PK").ToString();
                    string status = grid.GetRowValues(i, "StatusDesc").ToString();
                    ASPxWebControl.RedirectOnCallback(string.Format("~/Pages/InputSPPB.aspx?SPP_ID={0}&StatusDesc={1}", key, status));
                }
            }
        }
Exemplo n.º 3
0
        protected void gvAuthParameter_DataBinding(object sender, EventArgs e)
        {
            //initialize control
            BootstrapGridView gv          = (BootstrapGridView)gvMasterDataUser;
            BootstrapTextBox  txtusername = (BootstrapTextBox)gv.FindEditFormTemplateControl("txtUserName");
            BootstrapGridView gridAuth    = (BootstrapGridView)gv.FindEditFormTemplateControl("gvAuthParameter");

            string username = gv.GetRowValues(gv.EditingRowVisibleIndex, "Username") == null ? string.Empty : gv.GetRowValues(gv.EditingRowVisibleIndex, "Username").ToString();

            gridAuth.DataSource = ListAuthParameter(username);
        }
Exemplo n.º 4
0
        protected void gvMasterDataUser_HtmlEditFormCreated(object sender, DevExpress.Web.ASPxGridViewEditFormEventArgs e)
        {
            string param = Request.Params.Get("__CALLBACKPARAM");

            if (!String.IsNullOrEmpty(param))
            {
                if (!param.Contains("CANCELEDIT"))
                {
                    BootstrapGridView     gv                      = (BootstrapGridView)sender;
                    BootstrapTextBox      txtusername             = (BootstrapTextBox)gv.FindEditFormTemplateControl("txtUserName");
                    BootstrapTextBox      txtpassword             = (BootstrapTextBox)gv.FindEditFormTemplateControl("txtPassword");
                    BootstrapTextBox      txtpasswordconfirmation = (BootstrapTextBox)gv.FindEditFormTemplateControl("txtPasswordConfirmation");
                    BootstrapTextBox      txtemail                = (BootstrapTextBox)gv.FindEditFormTemplateControl("txtEmail");
                    BootstrapTextBox      txttelephone            = (BootstrapTextBox)gv.FindEditFormTemplateControl("txtTelephone");
                    BootstrapCheckBoxList chkrole                 = (BootstrapCheckBoxList)gv.FindEditFormTemplateControl("chkRole");
                    BootstrapGridView     gridAuth                = (BootstrapGridView)gv.FindEditFormTemplateControl("gvAuthParameter");


                    string username  = gv.GetRowValues(gv.EditingRowVisibleIndex, "Username") == null ? string.Empty : gv.GetRowValues(gv.EditingRowVisibleIndex, "Username").ToString();
                    string password  = gv.GetRowValues(gv.EditingRowVisibleIndex, "Password") == null ? string.Empty : gv.GetRowValues(gv.EditingRowVisibleIndex, "Password").ToString();
                    string email     = gv.GetRowValues(gv.EditingRowVisibleIndex, "Email") == null ? string.Empty : gv.GetRowValues(gv.EditingRowVisibleIndex, "Email").ToString();
                    string telephone = gv.GetRowValues(gv.EditingRowVisibleIndex, "Telephone") == null ? string.Empty : gv.GetRowValues(gv.EditingRowVisibleIndex, "Telephone").ToString();
                    string roles     = gv.GetRowValues(gv.EditingRowVisibleIndex, "RoleName") == null ? string.Empty : gv.GetRowValues(gv.EditingRowVisibleIndex, "RoleName").ToString();

                    //set textbox username
                    if (!String.IsNullOrWhiteSpace(username))
                    {
                        txtusername.Text = username;
                    }
                    txtusername.ValidationSettings.RequiredField.IsRequired = true;
                    txtusername.ValidationSettings.RequiredField.ErrorText  = "Field is Required";

                    //set textbox password
                    if (!string.IsNullOrEmpty(password))
                    {
                        txtpassword.Text             = Encryption.Decrypt(password);
                        txtpasswordconfirmation.Text = Encryption.Decrypt(password);
                    }
                    txtpassword.ValidationSettings.RequiredField.IsRequired             = true;
                    txtpassword.ValidationSettings.RequiredField.ErrorText              = "Field is Required";
                    txtpasswordconfirmation.ValidationSettings.RequiredField.IsRequired = true;
                    txtpasswordconfirmation.ValidationSettings.RequiredField.ErrorText  = "Field is Required";

                    //set textbox email
                    if (!String.IsNullOrWhiteSpace(email))
                    {
                        txtemail.Text = email;
                    }
                    txtemail.ValidationSettings.RequiredField.IsRequired = true;
                    txtemail.ValidationSettings.RequiredField.ErrorText  = "Field is Required";
                    txtemail.ValidationSettings.RegularExpression.ValidationExpression = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
                    txtemail.ValidationSettings.RegularExpression.ErrorText            = "Invalid Email Format";

                    //set textbox telephone
                    if (!String.IsNullOrWhiteSpace(telephone))
                    {
                        txttelephone.Text = telephone;
                    }
                    //txttelephone.ValidationSettings.RequiredField.IsRequired = true;
                    //txttelephone.ValidationSettings.RequiredField.ErrorText = "Field is Required";
                    txttelephone.MaskSettings.Mask = "99999999999999";

                    //set checkbox list role
                    //chkrole.DataSource = ListRole();
                    //chkrole.DataBind();
                    //chkrole.ValueField = "RoleID";
                    //chkrole.TextField = "RoleName";
                    chkrole.ValidationSettings.RequiredField.IsRequired = true;
                    chkrole.ValidationSettings.RequiredField.ErrorText  = "Field is Required";
                    if (!string.IsNullOrEmpty(roles))
                    {
                        string[] rolesid = roles.Split(';');
                        foreach (string item in rolesid)
                        {
                            foreach (BootstrapListEditItem i in chkrole.Items)
                            {
                                if (i.Value.ToString() == item.ToString())
                                {
                                    i.Selected = true;
                                }
                            }
                        }
                    }

                    // set grid auth parameter
                    if (ListAuthParameter(username).Count > 0)
                    {
                        gridAuth.DataBind();
                    }
                }
            }
        }