Problem with a button's OnClientClick event inside an UpdatePanel

Posted by royals on Stack Overflow See other posts from Stack Overflow or by royals
Published on 2010-03-01T05:07:37Z Indexed on 2010/06/09 4:32 UTC
Read the original article Hit count: 633

Filed under:
|
|

im using javascript like

var TargetBaseControl = null;
window.onload = function()
{
   try
   {
      //get target base control.
      TargetBaseControl = 
        document.getElementById('<%= this.GridView1.ClientID %>');
   }
   catch(err)
   {
      TargetBaseControl = null;
   }
}
function TestCheckBox()
{              
   if(TargetBaseControl == null) return false;

   //get target child control.
   var TargetChildControl = "chkSelect";

   //get all the control of the type INPUT in the base control.
   var Inputs = TargetBaseControl.getElementsByTagName("input"); 

   for(var n = 0; n < Inputs.length; ++n)
      if(Inputs[n].type == 'checkbox' && 
         Inputs[n].id.indexOf(TargetChildControl,0) >= 0 && 
         Inputs[n].checked)
       return true;        

   alert('Select at least one checkbox!');
   return false;
}

and inside the update panel i have code like

<asp:Button ID="ButtonSave" runat="server" OnClick="ButtonSave_Click"     
    OnClientClick="javascript:return TestCheckBox();" Text="Save" />

when i run the page and click the button then no more further processing just button has been click nothing happan......

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript