This blog defines how to call a JavaScript
function on ASP.NET.
ASPX code
<%@
Page Language="C#"
AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication11.WebForm1"
%>
<!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">
<title></title>
<script
language="javascript"
type="text/javascript">
function hideButton() {
document.getElementById("divAbc").style.visibility
= "hidden";
return false;
}
</script>
<div
id="divAbc">
<table><tr><td
style="width:
200px; height:
100px; background-color:
red"></td></tr></table>
</div>
</head>
<body>
<form
id="form1"
runat="server">
<asp:Button
ID="btnHide"
Runat="server"
Text="Hide"
/>
</div>
</form>
</body>
</html>
Now double click on the form and the following
code page load event.
Protected
Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs)
Handles Me.Load
btnHide.Attributes.Add("onclick",
"return hideButton()")
End Sub