>protected override void OnInit(EventArgs e) >{ > // Client Id of Checkbox > // ctl00_ctl00_Retirement Mangement System_cphOuterContent_cphMainContent_RightContent_ctrlAgreement_chkAgree > // Client Id of Button > // ctl00_ctl00_Retirement Mangement System_cphOuterContent_cphMainContent_RightContent_ctrlAgreement_btnAgreeContinue > > StringBuilder sb = new StringBuilder(); > sb.Append(@"function SetAgreeAndContinue(checkbox) {"); > sb.Append(@"var s = checkbox.id.substr(0, checkbox.id.lastIndexOf('_') + 1) + 'btnAgreeContinue';"); > sb.Append(@"var button = document.getElementById(s);"); > sb.Append(@"button.disabled = !checkbox.checked;"); > sb.Append(@"}"); > > Page.ClientScript.RegisterClientScriptBlock(GetType(), "AgreementScript", sb.ToString(), true); > base.OnInit(e); >} >>
sb.Append(@"button = null;"); sb.Append(@"function SetAgreeAndContinue(checkbox) {"); sb.Append(@"if (button == null){"); sb.Append(@"button = document.getElementById(checkbox.id.substr(0, checkbox.id.lastIndexOf('_') + 1) + 'btnAgreeContinue');"); sb.Append(@"}"); sb.Append(@"button.disabled = !checkbox.checked;"); sb.Append(@"}");