简体   繁体   English

在文本asp.net c#之后将焦点放在文本框中

[英]focus in textbox after text asp.net c#

I am trying to focus in textbox after text in asp.net c# but I am unable to do it 我试图在asp.net c#中的文本之后将焦点放在文本框中,但是我无法做到这一点

my c# code is given below, please tell me where i am wrong:- 我的C#代码如下,请告诉我我错了:-

 TextBox txtindex = (TextBox)RptTask.Items[Nextindex].FindControl("TxtDuration");
 txtindex.Focus();

Apply Focus Method on Text in Page_PreRender 将焦点方法应用于Page_PreRender文本

//pre-render code as given below, 
protected void Page_PreRender(object sender, EventArgs e)
{
   try
     {
       TextBox txtindex = (TextBox)RptTask.Items[Nextindex].FindControl("TxtDuration");
       txtindex.Focus();
     }
   catch(Exception ee)
    {
    }
} 

Hope It will Help! 希望对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM