Programmatic Use of DefaultButton Doesn't Work in FireFox

G

Guest

I have found a situation where the DefaultButton and DefaultFocus stop
working under FireFox. I'm looking for any kind of fix or work around.

The problem seems to happen when setting a control that is part of another
control, like a templated control. The docs say to use the UniqueID in this
case. In the example below I am trying to set controls in the Login
control's LayoutTemplate.

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Page.Form.DefaultButton = login.FindControl("Login").UniqueID;
Page.Form.DefaultFocus = login.FindControl("UserName").UniqueID;
}
}

This code works fine for IE but not for FireFox. The same teqnique seems to
work fine for FireFox if the control is not part of a templated control like
just a TextBox control on the page. This may be because the UniqueID is just
the controls ID. I wonder if this fails in the MasterPage scenario.

Thanks for any help,
Tyler
 
Y

Yuan Ren[MSFT]

Hi Tyler,

Thanks for posting!

For the current issue, making a simple demo which can repro the problem is
appreciated. I understand this will take you some time to do this. However,
this really will help me to perform the testing and figure out some factors.

If you have made a demo, please don't hesitate to send it to me as zipped.
My alias is (e-mail address removed) (remove .online). Thanks for your
understanding.

I'm looking forward your reply!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
G

Guest

I did some more testing and found that the DefaultButton is working, and that
it is the DefaultFocus that is not. I was implementing both at the same
time. After separating them I could see that just the DefaultFocus is the
problem for FireFox when the Unique ID is different from the controls normal
ID. This is the case in instances like a masterpage or templated control.

Tyler
 
Y

Yuan Ren[MSFT]

Hi Tyler,

Thanks for your patience!

I have reproduced the current issue and reported to our dev team.
Unfortunately, there is no workaround at the current stage. I'm sorry that
the issue is not fixed due to the problem is specific for the Firefox
browser. However, our dev team has scheduled the issue in the next service
packs. I still recommend you submit a feedback to the Microsoft product
feedback. If the issue is critical, the priority will be up. I appreciate
your understanding!

You can submit the feedback via the following link:
http://lab.msdn.microsoft.com/ProductFeedback/

Your idea will be appreciated!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
G

Guest

I submitted a product feedback. For now the work around I am using is to
call Focus() on the control itself.

((TextBox)login.FindControl("UserName").UniqueID).Focus();

Thanks for verifying this issue.

Tyler
 
Y

Yuan Ren[MSFT]

Hi Tyler,

You are welcome:) I'll submit your workaround to the dev team. I think they
will reference it in the next version. Your idea is really appreciated!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,701
Latest member
XavierQ83

Latest Threads

Top