Re: Form.DefaultButton stopped working in firefox

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



hi guys,
many thanks for the detailed replies.
i was a bit thrown because i read in the HtmlForm.DefaultButton property in the docs that "If you are using master pages in your application and you are setting the DefaultButton property from a content page, use the UniqueID property of the IButtonControl button", and assumed this would also work for normal pages. i re-read it now and it does clearly say to use the ID property first, so my bad, but it is slightly annoying that the behaviour changes for master pages or normal pages, particularly because we can't use the declarative syntax for child pages since the form tag is in the master page.

thanks anyway, i can live with it!
tim



"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message news:K$kOPj9UHHA.300@xxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for Jason's informative input.

Hi Tim,

As Jason has suggested, for the Form.DefaultButton and Form.DefaultFocus
setting code, there are two places you need change:

1. You need to put the code that configure the HtmlForm.DefaultFocus and
DefaultButton in every reques(no only the initial request)

2. You should use "ID" property rather than "ClientID" or "uniqueID".
Actually, for server-side processing, generally we only need to use
Control's ID(the other twos are mostly used for client-side processing).

Here is the modified codebehind code snippet I've used correctly on my
side(win XP sp2, ie7 and ff2.0):

=====================

public partial class nav_NavButtonPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

Page.Form.DefaultButton = btnSelect.ID;
Page.Form.DefaultFocus = txtID.ID;


}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("BOGUS BUTTON");

}
protected void btnSelect_Click(object sender, EventArgs e)
{
Response.Write("SUBMIT BUTTON");
}
}

===========================

Hope this also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • Re: MasterPages and a Base class
    ... the HtmlMeta control can help build meta element ... As for setting meta keywords in Master page, ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Reference required to assembly error
    ... anything in the content pages that has been referenced by the master pages ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ... Compilation Error ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: anyone used master pages/themes
    ... Regarding on the Master page, it can help define some contentplaceholder ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ... project analysis and dump analysis issues. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: JavaScript in content pages?
    ... For the original script you provided: ... the limitation here (for master page based one) is that the "tbEmail" is ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Error event in UserControl
    ... protected void Button1_Click(object sender, EventArgs e) ... Microsoft Online Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)