FYI,
You need to make sure you set the full ID of the button, easiest way to do
this is to use the UniqueID property of the control...

master.DefaultButton = SomeButton.UniqueID;

On 2/28/07, Dean Fiala <[EMAIL PROTECTED]> wrote:
>
> yes,
> you can access the form element in the master page programmatically and
> set the default button in code on a page-by-page basis...
>
> Add a property to your master page.  You'll note the form element for the
> master page is already set to runat=server
>
> public string DefaultButton
>     {
>         get { return form1.DefaultButton; }
>         set { form1.DefaultButton = value; }
>     }
>
> in your page code get a reference to your master page and set the property
>
>
> MyMasterPage master = (MyMasterPage)Page.Master;
> master.DefaultButton = "nameOfSomeButton":
>
>
>
> On 2/28/07, Rick < [EMAIL PROTECTED]> wrote:
> >
> >   I failed to mention that this is part of a control and the master page
> >
> > holds the form tag, so I cannot do that because I don't want the
> > default button to be the same for every page that calls the master
> > page. Also I am not using panels. Is there any other way?? TIA
> >
> > Sincerely,
> > Rick
> >
> > You need to set the defaultbutton property of the HTML form or panel....
> >
> > <form id="form1" runat="server" defaultbutton="Button1">
> > <div>
> > <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
> > <asp:Button ID="Button1"
> > runat="server" Text="Button" OnClick="Button1_Click" />
> > </div>
> > </form>
> >
> >  
> >
>
>
>
> --
> Dean Fiala
> Very Practical Software, Inc
> Now with Blogging...
> http://www.vpsw.com/blogbaby
> Microsoft MVP




-- 
Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP


[Non-text portions of this message have been removed]

Reply via email to