Blog Stats
  • Posts - 48
  • Articles - 0
  • Comments - 107
  • Trackbacks - 0

 

Setting a default button when using master pages

Its always the little things in life!  This was pretty easy...once I found it that is.

this.Form.DefaultButton = this.ButtonControl.UniqueID.ToString();

Feedback

# re: Setting a default button when using master pages

Gravatar If you place your asp:Button in an asp:Panel you can set the defaultButton property of the panel to the button you desire.

This is especially handy on pages with multiple input "forms". 11/5/2007 5:32 PM | Jason Whitehorn

# re: Setting a default button when using master pages

Gravatar But how change graphics and ser colour for the button? .. thanks 12/15/2007 5:54 AM | Regali di Natale

# re: Setting a default button when using master pages

Gravatar You can set the color of the buttons in two primary ways...using CSS/inline styles, or you can use ASP.NET themes.


Inline styles could look something like this:
/*color of the background of the button*/
background-color:#ff0000;

/*font color of the button*/
color:#ff0000;

Or you can do css something like this:
<style>
.buttonStyle
{
background-color:#ff0000;
color:#ff0000;
}
</style>
<asp:Button cssclass="buttonStyle" id="etc" runat="server" text="button"></asp:Button>

For more on themes look here: http://msdn2.microsoft.com/en-us/library/de93t31k.aspx 12/15/2007 10:51 AM | Andrew Siemer

# re: Setting a default button when using master pages

Gravatar hi thanks
its working fine 8/27/2008 12:10 AM | Srinivas Vadluri

# re: Setting a default button when using master pages

Gravatar Looking great! But one question why to use ToString() when UniqueId itself returns string!! 3/28/2009 3:59 AM | Ajaykumar Raju

# re: Setting a default button when using master pages

Gravatar I have a problem, I have one master page however the default button is in webcontrol. How set default button in this case?

thanks 10/14/2009 5:53 PM | angelestradamx

Post a comment





 

 

 

 

Copyright © Andrew Siemer - www.andrewsiemer.com