asp.net - changing validation group of button with javascript on client side -


In one form, I have several group controls grouped by valid group group. I want to assign a validation group to asp.button dynamically on the client side using javascript based on the selected item in the drop down list.

Here I am using javascript, but it is not working. This verification group shows the undefined, but is actually a default group defined.

Please give me advice

  & lt; Script type = "text / javascript" & gt; Function nextlight () {var_ddlStatus = document.getElementById ("& lt;% = ddl.ClientID%>"); Var _selectedIndex = _ddlStatus.selectedIndex; Var _btn = document.getElementById ("& lt;% = btnNext.ClientID%>"); Warning (_btn.ValidationGroup); // This undefiend shows in the message here, even though I default defiend a group in the button. If (_selectedIndex == 1) {_btn.ValidationGroup = "G1"; } And if (_selectedIndex == 2) {_btn.ValidationGroup = "G2"; }}  

  function changeValidationGrop () {var _ddlStatus = document.getElementById (" & Lt;% = ddl.ClientID% & gt; "); Var _selectedIndex = _ddlStatus.selectedIndex; Var BTN = Document. GetElementById ("& lt;% = btnNext.ClientID%>"); Var newValGroup; If (_selectedIndex == 1) newValGroup = "G1"; Other new groups = "G2"; Btn.onclick = function () {WebForm_DoPostBackWithOptions (New WebForm_PostBackOptions ("btnNext", "", true, newValGroup, "", false, false)); }}  


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -