一、设置空间成为焦点
二、设置WebForm窗体默认按钮Page.SetFocus(Control) ,Control为空间的ID
Page.SetFocus(Control.ClientID)
Control.Focus() 控件上直接设置Focus()方法
protected void Page_Load(object sender,EventArgs e)
{
Page.SetFocus(btnClear);
//this.SetFocus(btnClear);
//Page.SetFocus(btnClear.ClientID);
//btnClear.Focus();
}
<form id="form1" defaultbutton="btnSubmit" defaultfocus="txtID" runat="server">