</div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br /> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</form></body>
</html>
三、用javascript把值传给HiddenField
javascript直接改变控件的值再后台取不到值,存在HiddenField中变相的取值,
<!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 type="text/javascript">
function setValue(){
document.getElementById("<%=name.ClientID %>").value="aaaa";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HiddenField ID="name" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button"
OnClientClick="setValue()" onclick="Button1_Click" />
</div>
</form>
</body>
</html>








