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)

Collapse | Copy Code
<div class="FQA">Quote/div>blockquote class="FQ"><div class="FQA">Quote/div><script language="javascript" type="text/javascript">
function ParentValidate() {
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;

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

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.