[RESOLVED]Very basic html/javascript problem

I’m trying to get a very basic javascript test working.  I’m getting:

BC30456: ‘handleuploadbutton’ is not a member of ‘ASP.default_aspx’.

Thanks for any clues since, apparently, I don’t have one.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="temp2._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

        <script type="text/javascript">
            function handleuploadbutton(uploadButton) {
                document.getElementById(uploadButton).visible = false;

    <form id="form1" runat="server">
    <asp:Button ID="Button1" runat="server" Text="Button" 
    <asp:Button ID="Button2" runat="server" Text="Button" />

It looks like you are trying to use the button’s server side event.  I believe the client side event is OnClientClick.  I just did a quick search to confirm what I was thinking and found pretty much the same answer on StackOverflow.


I changed OnClick to OnClientClick and the error went away. thanks.

I’m trying to get button2 to disappear when I click button1, 

Can you see what I’m doing wrong? It seems to reload the page but both buttons are still there.


You will want to set the ClientIDMode to static so that the name generated will be the same.  You will also want to return false in your button to prevent the post back.  Here is some code I did real quick in a test page that hides Button 2 when I click
Button 1.

<asp:Button ID="btnButton1" ClientIDMode="Static" runat="server" OnClientClick="HideButton2(); return false;" Text="Button 1" />
<asp:Button ID="btnButton2" ClientIDMode="Static" runat="server" Text="Button 2" />

    function HideButton2()
        var button2 = document.getElementById("btnButton2");
        button2.style.visibility = "hidden";

Thank you for both the OnClientClick and return false;  

It’s all working now.

Leave a Reply