记得有本书上说.NET 最好使用后代码来写程序,少用象ASP一样的脚本代码块,但是实际上感觉很多地方用后代码缺乏弹性,不象脚本代码块灵活.如(ASP.NET技术内幕中的实例):
<script runat ="server">
sub button_command(s as object,e as commandeventargs)
dim intamount as integer
intamount=e.commandargument
if e.commandname="add" then
lb.text += intamount
else
lb.text -= intamount
end if
end sub
</script>
<html>
<head>
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lb" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" CommandArgument="10" CommandName="aee" Text="Button" />
<asp:Button ID="Button2" runat="server" CommandArgument="5" CommandName="add" Text="Button" />
</div>
</form>
</body>
</html>
实际就是一个COMMAND事件,判断点击的是哪一个命令按钮(直接复制到ASP.NET2.0中无法执行).这种判断在后代码怎么写??想了半天没想通,谁知道啊???