Thursday, February 16, 2012

Checkboxlist Checked Event Client Side Using JavaScript

<script type="text/javascript"> 
function CheckBoxChecked(ChkID) {
            var status = false;
            var CheckBoxID = document.getElementById('<%=
chkHvecYes.ClientID%>');
            if (CheckBoxID.checked == true){
            status=true;
                return status;}
            else {
                alert('Please Select CheckBox');
                return status;
            }

        }
//chkHvecYes  is checkboxlist Id
function SeletedTab() {         
            var checkBoxArray = document.getElementById('<%=chkIso_action.ClientID%>').getElementsByTagName('input');          
                var checkBoxRef = checkBoxArray[5];     // for 7th Item in the checkboxlist
                if (checkBoxRef.checked) {
document.getElementById('plock').style.display = "block";
 document.getElementById('plock').style.visibility = "visible";
                }

else
                    document.getElementById('plock').style.
display
= "none";document.getElementById('plock').style.visibility = "hidden";
           
        }
</script>
<p id="plock">
  Checkboxlist Checked Event or Onclick Client Side Using JavaScript
</p>
<asp:CheckBoxList  ID="chkIso_action" runat="server" onclick="SeletedTab() ">
<asp:ListItem Text="Test1" Value="0">
<asp:ListItem Text="Test1" Value="1">
<asp:ListItem Text="Test1" Value="2">
<asp:ListItem Text="Test1" Value="3">
<asp:ListItem Text="Test1" Value="4">
<asp:ListItem Text="Test1" Value="5">   
</asp:CheckBoxList >

<asp:Button runat="server" Text="Submit" ID="btnHSubmit" OnClientClick="
CheckBoxChecked(this)"></asp:Button>

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software