我做了个登陆的页面,上面只有一个button 是个webcontrol,另外还有个文本框,可是在文本框输入回车的时候却不是激发 button的onclick事件。。这是为什么呢?直接点击这个button是可以正确执行的,没有问题。
aspx文件如下
<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="gx.Login" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Login</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 56px" runat="server">用户名</asp:label>
<asp:label id="Label2" style="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 96px" runat="server">密码</asp:label>
<asp:textbox id="TextBoxPassword" style="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 96px"
runat="server" TextMode="Password"></asp:textbox>
<asp:button id="ButtonLogin" style="Z-INDEX: 104; LEFT: 224px; POSITION: absolute; TOP: 168px"
runat="server" Text="登陆" Width="72px" Height="24px"></asp:button>
<asp:dropdownlist id="DropDownListUsername" style="Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 56px"
runat="server" Width="152px" Height="24px" ForeColor="Black"></asp:dropdownlist>
<asp:Label id="LabelLoginHints" style="Z-INDEX: 106; LEFT: 200px; POSITION: absolute; TOP: 136px"
runat="server" Height="16px" Width="160px" Visible="False"></asp:Label></form>
</body>
</HTML>
生成的html页面源代码如下
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Login</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="login.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDwtMjAyODkxODIxNDt0PDtsPGk8MT47PjtsPHQ8O2w8aTw5Pjs+O2w8dDx0PHA8cDxsPERhdGFNZW1iZXI7RGF0YVRleHRGaWVsZDs+O2w8WW9uZ2h1O21pbmdjaGVuZzs+Pjs+O3Q8aTwxPjtAPGFkbWluOz47QDxhZG1pbjs+Pjs+Ozs+Oz4+Oz4+Oz6mXAwirhGRHCGNRsa9w1rNH6t3GA==" />
<span id="Label1" style="Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 56px">用户名</span>
<span id="Label2" style="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 96px">密码</span>
<input name="TextBoxPassword" type="password" id="TextBoxPassword" style="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 96px" />
<input type="submit" name="ButtonLogin" value="登陆" id="ButtonLogin" style="height:24px;width:72px;Z-INDEX: 104; LEFT: 224px; POSITION: absolute; TOP: 168px" />
<select name="DropDownListUsername" id="DropDownListUsername" style="color:Black;height:24px;width:152px;Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 56px">
<option value="admin">admin</option>
</select>
</form>
</body>
</HTML>
<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="gx.Login" %>可以看到input type=submit 的确在 form里面,可是就是没有效果,这是为什么呢?
多谢各位达人了
aspx文件如下
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
生成的html页面源代码如下
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="gx.Login" %>可以看到input type=submit 的确在 form里面,可是就是没有效果,这是为什么呢?
多谢各位达人了