本文介绍了通过此代码,我想将光标从上一个控件移到下一个控件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#region EnterPress
    txtEmployeeName.Focus();
    txtEmployeeName.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                                "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                       "{document.getElementById('" + txtDate.ClientID +
                               "').focus();return false;}} else {return true}; ");

    txtDate.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                                 "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                        "{document.getElementById('" + rbtnMale.ClientID +
                                "').focus();return false;}} else {return true}; ");
    rbtnMale.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + rbtnFemale.ClientID +
                              "').focus();return false;}} else {return true}; ");
    rbtnFemale.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtPhone.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtPhone.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtEmail.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtEmail.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtEmergencyContactNo.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtEmergencyContactNo.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtMaritalStatus.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtMaritalStatus.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtBloodGroup.ClientID +
                              "').focus();return false;}} else {return true}; ");

    txtBloodGroup.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtPassportNoWithDetails.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtPassportNoWithDetails.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtNationality.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtNationality.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtDrivingLicenceNo.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtDrivingLicenceNo.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtReferences.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtReferences.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtCorrespondenceAddress.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtCorrespondenceAddress.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtPermanentAddress.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtPermanentAddress.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtName.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtName.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtRelationship.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtRelationship.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtDateTo.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtDateTo.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtOccupation.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtOccupation.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + chkDependentorNot.ClientID +
                              "').focus();return false;}} else {return true}; ");
    chkDependentorNot.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtQualificationInstitution.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtQualificationInstitution.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtPeriodofEducationalCourse.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtPeriodofEducationalCourse.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtExaminationYearofPassing.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtExaminationYearofPassing.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtBoard.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtBoard.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtPercentageMarks.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtPercentageMarks.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtDivision.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtDivision.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtSkills.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtSkills.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtExperience.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtExperience.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                               "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                      "{document.getElementById('" + txtDateofJoining.ClientID +
                              "').focus();return false;}} else {return true}; ");
    txtDateofJoining.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtProbationPeriod.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtProbationPeriod.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtConfirmationDate.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtConfirmationDate.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtPANNo.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtPANNo.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtESIC.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtESIC.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtPFNumber.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtPFNumber.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtFamilyPFNumber.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtFamilyPFNumber.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + rbtnCheque.ClientID +
                            "').focus();return false;}} else {return true}; ");
    rbtnCheque.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + rbtnCash.ClientID +
                            "').focus();return false;}} else {return true}; ");
    rbtnCash.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + rbtnBankTransfer.ClientID +
                            "').focus();return false;}} else {return true}; ");
    rbtnBankTransfer.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtBankAccountNo.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtBankAccountNo.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtBankName.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtBankName.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtCompany.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtCompany.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + ddlDepartment.ClientID +
                            "').focus();return false;}} else {return true}; ");
    ddlDepartment.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + ddlDesignation.ClientID +
                            "').focus();return false;}} else {return true}; ");
    ddlDesignation.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + ddlGrade.ClientID +
                            "').focus();return false;}} else {return true}; ");
    ddlGrade.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + ddlEmployeeType.ClientID +
                            "').focus();return false;}} else {return true}; ");
    ddlEmployeeType.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtReportingAuthorityName.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtReportingAuthorityName.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + txtInsuranceCompanyNo.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtInsuranceCompanyNo.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                           "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                  "{document.getElementById('" + txtInsuranceCompanyNoName.ClientID +
                          "').focus();return false;}} else {return true}; ");
    txtInsuranceCompanyNoName.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                             "{if ((event.which == 13) || (event.keyCode == 13)) " +
                                    "{document.getElementById('" + chkEligibleForOverTime.ClientID +
                            "').focus();return false;}} else {return true}; ");
    txtInsuranceCompanyNoName.Attributes.Add("onkeydown", "if(event.which || event.keyCode)" +
                        "{if ((event.which == 13) || (event.keyCode == 13)) " +
                               "{document.getElementById('" + btnSave.ClientID +
                       "').focus();return false;}} else {return true}; ");
    #endregion

推荐答案


这篇关于通过此代码,我想将光标从上一个控件移到下一个控件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 07:04