Asp.Net 默认按钮
方法一:
function document.onkeydown()
{
if(event.keyCode==13)
{
document.form1.all.Submit.click(); //这里的submit是按钮的ID
}
}
方法二:
<form id="form1" runat="server" defaultbutton="button1">
<div>
<asp:Panel DefaultButton="button1"></asp:Panel>
<asp:Button ID="button1" runat="server" Text="Button1" />
</div>
</form>
方法三:
在Page_Load中加入如下代码
TextBox.Attributs.Add("onkeydown","if(keyCode==13) {document.all.Button2.focus(); document.all.Button2.click();}");
方法四:
<form id="form1" runat="server" defaultbutton="Ok">
<!--设置form的属性 defaultbutton=“默认按钮ID” 这个是我在VS2005中式的-->
方法五:
2个以上的textbox,先判断焦点在选择对应的按钮
<script type="text/javascript">
function document.onkeydown()
{
if(event.keyCode==13)
{
if(document.activeElement.id == "Text1")
{
document.form1.all.Button1.click(); //这里的submit是按钮的ID
}
else if(document.activeElement.id == "Text2")
{
document.form1.all.Button2.click(); //这里的submit是按钮的ID
}
}
}
</script>
<input id="Text1" type="text" />
<input id="Button1" type="button" value="button" onclick="javascript:alert('Button1 is onclick!')" />
<br />
<input id="Text2" type="text" />
<input id="Button2" type
相关文档:
ASP。NET中共有几种类型的控件
========================================
两种:
1. 客户端控件,也就是我们在HTML中经常用到的
2. 服务端控件,例如: <asp:TextBox ID="txt" runat="server" />
客户端控件也可以转成服务端控件
<input type="text" id="txt" runat="server" />
HTML 和 WEB
ASP。NET ......
原地址:
http://msdn.microsoft.com/en-us/library/aa480476.aspx
IIS Authentication
ASP.NET authentication is a two-step process. First, Internet Information Services (IIS) authenticates the user and creates a Windows token to represent the user. IIS determines the authentication mode that it shoul ......
<asp:checkbox id = "checkbox1" runat = "server" AutoPostBack = "true" OnCheckedChanged = "CheckAllBox_Checked" text = "全选">
<asp:CheckBox ID = "CheckBox1" AutoPostBack = "true" OnCheckedChanged = "CheckBox1_Checked" runat = "server"/>
protected void CheckBox1_Checked(obj ......
ASP.NET允许我们在global.asax文件中编写能够接受全局事件的事件处理器。用户不会直接请求这个global.asax文件,而是在响应一个确定的应用程序事件中自动的执行global.asax文件。global.asax文件提供了跟传统的ASP应用程序中的global.asa文件类似的服务。
在global.asa ......