Click here to Skip to main content
15,887,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have a left side textbox and a find button and similarly, a right side textbox and a find button. Clicking on the either side button will display a grid with populated data. The right side button should not display any grid, IF the left side grid is not displayed and any row is not selected in that grid. for this validation, I have scripted the code as follows: ( this gets called on right side button onclientclick="return ParentValidate()" event)

HTML
<div class="FQA">Quote:</div>blockquote class="FQ"><div class="FQA">Quote:</div><script language="javascript" type="text/javascript">
   function ParentValidate() {
       debugger;
       var childflagP = 0;
       var gridchildP = null;
      var gridchildP = document.getElementById("<%=GrdLeftSide.ClientID%>");
       if (gridchildP != null) {
           var rbchildP = gridchildP.getElementsByTagName("input");
           for (var i = 0; i < rbchildP.length; i++) {
               if (rbchildP[i].type == "radio") {
                   if (rbchildP[i].checked) {
                       childflagP = 1;
                       break;
                   }
               }
           }
       }

       if (childflagP == 0) {
           alert("Please Select a row in the left grid");
           return false;
       }
       else {
           return true;
       }
   }
</script>



If left grid is present, if even though no row is selected in it, this method works fine. But if, no grid is present on the page, this method doesn't get called and right grid gets displayed without passing this validation.

Please help how to get the method called even if there is no grid on the screen.

Thanks!
Posted
Updated 25-Nov-11 7:16am
v2
Comments
thatraja 26-Nov-11 22:59pm    
Any error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900