txtID.Attributes.Add("onactivate", "onnamefocus()");
<script language="javascript" type="text/javascript">
function onnamefocus()
{
var btnSelect=document.getElementById ("<%=btnSelect.ClientID %>");
//but_searchname.setActive();
btnSelect.focus();
}
</script>
<asp:TextBox ID="txtID" runat="server" Width="93px" ></asp:TextBox>
<asp:Button ID="btnSelect" runat="server" OnClick="btnSelect_Click" Text="查询" />