Yes -- try this out:
First, you'll need to determine if there is no data. Easy enough, right? So let's make a variable called noData -- values 0 or 1 (1 = no data, 0 = there is data). This is obviously going to be set in your server side scripting.
Then, we'll do two things:
(1) set a global javascript variable to hold that value, so you can get at it client-side
(2) write another javascript function to check the value of that variable and then either call or don't call your function that you were (are) calling onClick of your button:
<script language=javascript>
var noData = <%=noData%>; //notice the same names for the variables, but one is ASP and one is JS
function checkForNoData(){
if (noData){
onClickFunction();
}
}
</script>
We'll just evaluate noData as if it was a boolean variable (which, in essence, it is). We'll call checkForNoData() body onLoad
<body onLoad="checkForNoData();">
And there you have it.

Paul Prewett