在asp.net中使用TAB聚焦光标 [英] Focus cursor using TAB in asp.net

查看:97
本文介绍了在asp.net中使用TAB聚焦光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP .NET中,当我按下窗体的最后一个控件上的Tab时,光标将转到地址栏。但是我希望光标会集中在其他控件上。

我使用textbox.focus()来集中控制。但是我应该在哪里使用此代码或此代码适用于asp.net?请帮助我。

In ASP .NET when I press the Tab on the last control of a form then cursor goes to the address bar. But I want cursor will focus on other control.
I use textbox.focus() to focus control. But where should I use this code or is this code applicable for asp.net? Please help me.

推荐答案

使用 TabIndex 控件的属性。



请参阅:

http://msdn.microsoft .com / zh-CN / library / ms178231.aspx [ ^ ]
Use TabIndex property of Controls.

see this:
http://msdn.microsoft.com/en-us/library/ms178231.aspx[^]


<pre lang="cs">protected void Page_Load(object sender, EventArgs e)
  {
      if (!IsPostBack)
      {
          txtbox1.TabIndex = 1;
          txtbox2.TabIndex = 2;
          txtbox3.TabIndex = 3;
//add your controls here
      }
  }</pre>


这篇关于在asp.net中使用TAB聚焦光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆