Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Olá pessoal, estou precisando da ajuda de vocês.

Tenho uma página asp.net(webforms) com os seguintes controles:
1 TabContainer e 4 TabPanel

Quote:
Hi guys, I need your help.

I have an asp.net(webforms) page with the following controls:
1 TabContainer and 4 TabPanel


Dentro do primeiro TabPanel1 tenho um controle do tipo Edit1.text, quando digito algo dentro dele tento estabelecer o focus no Edit2, mas não esta dando certo, vou deixar aqui minhas tentativas
Quote:
Inside the first TabPanel1 I have a control of type Edit1.text, when I type something inside it I try to establish the focus on Edit2, but it's not working, I'll leave my attempts here

C#
//Já tentei estabelecer o focus usando findControl
//I already tried to establish the focus using findControl
TextBox MyTextBox = (TextBox)((TextBox)sender).FindControl("Edit2");
MyTextBox.Text = "Hello";
MyTextBox.Focus();

Obs:O texto "Hello" funciona mas o Focus() não funciona
Quote:
Note: The text "Hello" works but Focus() does not

//Já tentei
//I tried
C#
TabContainer tb = ((TabContainer)this.TabContainer1.FindControl("TabContainer1"));
TabPanel tp = ((TabPanel)tb.FindControl("TabPanel1"));
((TextBox)tp.FindControl("Edit2")).Text = "TesteFocus";
((TextBox)tp.FindControl("Edit2")).Focus();


Tentei algumas funções JS mas sem sucesso.

Alguém já passou por isso?

Poderia ajudar?
Quote:
I tried some JS functions but without success.

Has anyone ever experienced this?

Could help?


What I have tried:

//Já tentei estabelecer o focus usando findControl
<pre lang="C#">TextBox MyTextBox = (TextBox)((TextBox)sender).FindControl("Edit2");
MyTextBox.Text = "Hello";
MyTextBox.Focus();

Obs:O texto "Hello" funciona mas o Focus() não funciona

//Já tentei
<pre lang="C#">TabContainer tb = ((TabContainer)this.TabContainer1.FindControl("TabContainer1"));
TabPanel tp = ((TabPanel)tb.FindControl("TabPanel1"));
((TextBox)tp.FindControl("Edit2")).Text = "TesteFocus";
((TextBox)tp.FindControl("Edit2")).Focus();
Posted
Updated 8-May-22 2:27am
v2
Comments
Richard MacCutchan 8-May-22 7:28am    
This is an English language site, please translate your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900