Visual Studio 2005做Web程序的时候,删除控件后代码还存在。怎么解决?
[size=12px][/size]比如我拖放了一个Button控件出来,我不要了,删除了。但代码还存在!这个问题应该怎么样去解决呢?
下边是代码,我拖了一个Button控件出来,双击进入事件编程,但我到页面删除了Button之后,代码还存在!
<script language="javascript" type="text/javascript">
// <!CDATA[
function Button1_onclick() {
}
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /> </div>
</form>
</body>
</html>
------解决方案--------------------这个在2005中很正常啊,与2003有很大区别的
--------------------下面是C#
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>
</html>