function TestCheckBox() { TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>'); if(TargetBaseControl == null) return false; //get target child control. var TargetChildControl = "CheckBox1"; //get all the control of the type INPUT in the base control. var Inputs = TargetBaseControl.getElementsByTagName("input"); var c=0; for(var n = 0; n < Inputs.length; n++) { if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0 && Inputs[n].checked) { c++; // return true; } } if(c==1) { return true; } else if(c>1) { for(var j=0;j<Inputs.length;j++) { Inputs[j].checked=false; } alert('Please select only one transaction'); return false; } else if(c==0) { alert('Please select One transaction!'); return false; } } another function is function confirmdelete() { if(confirm("Are u sure delete partyhall")==true) return true; else return false; }
<asp:Button ID="deletebtn" runat="server" Text="Delete Partyhall" BackColor="#0099FF" Font-Bold="true" Font-Size="10pt" ForeColor="White" OnClientClick="javascript:return TestCheckBox();" onclick="deletebtn_Click" />
OnClientClick="javascript:return TestCheckBox();javascript:return confirmdelete()"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)