如何使用C#在ASP.NET中的ajax tabcontainer内部的文本框上设置焦点 [英] How to set focus on a text box inside a ajax tabcontainer in ASP.NET using C#

查看:100
本文介绍了如何使用C#在ASP.NET中的ajax tabcontainer内部的文本框上设置焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我在一个选项卡上有一个名为tabMain的TabContainer和一个名为txtTest的文本框.当我单击包含txtTest的选项卡时,我要将焦点移到该文本框控件.可以在TabContainer之外轻松完成此操作,但是TabContainer必须具有不同的功能并且不允许焦点.

任何帮助将不胜感激.
谢谢

我尝试过的事情:

For example, I have a TabContainer named tabMain and a text box named txtTest on one of the tabs. When I click the tab that contains txtTest I want to move the focus to that textbox control. It can be easily done outside of the TabContainer but the TabContainer must function differently and it is not allowing the focus.

Any help would be greatly appreciated.
Thanks

What I have tried:

ScriptManager.GetCurrent(Page).SetFocus("txtTest");

tabMain.FindControl("txtTest").Focus();

txtTest.Focus();

推荐答案

首先在浏览器中检查TextBoxId .然后尝试使用该Id并找到控件并设置focus. ID可能取决于容器.

由于它位于TabContainer内部,因此我认为该ID已修改.
First of all on browser check the Id of the TextBox. Then try to use that Id and find the control and set focus. The Id might be dependent upon the container.

As it is inside the TabContainer, so I think the Id is modified.


这篇关于如何使用C#在ASP.NET中的ajax tabcontainer内部的文本框上设置焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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