T
Tony Johansson
Hello!
Below I have a simple html code where I have dragged a HTML control into the
page.
As you can see below I have specified runat=server for this html control so
it's now a html server control
Now to the strange problem how is it possible that when I click on the
button the event handler on the client is called.
How can that happen when I have specified runat=server. I have thought when
you specified runat=server you can only use
event handler on the server ?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_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">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
<!--
function Button1_onclick()
{
document.write('Hello');
}
// -->
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" runat="server" style="z-index: 102; left: 116px;
position: absolute; top: 368px"
type="button" value="button" language="javascript"
onclick="return Button1_onclick()" />
</div>
</form>
</body>
</html>
Below I have a simple html code where I have dragged a HTML control into the
page.
As you can see below I have specified runat=server for this html control so
it's now a html server control
Now to the strange problem how is it possible that when I click on the
button the event handler on the client is called.
How can that happen when I have specified runat=server. I have thought when
you specified runat=server you can only use
event handler on the server ?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_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">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
<!--
function Button1_onclick()
{
document.write('Hello');
}
// -->
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" runat="server" style="z-index: 102; left: 116px;
position: absolute; top: 368px"
type="button" value="button" language="javascript"
onclick="return Button1_onclick()" />
</div>
</form>
</body>
</html>