Question How do I customize an asp:Button class?

Xarzu

Member
Joined
May 24, 2010
Messages
5
Programming Experience
Beginner
How do I customize an asp:Button class?

I have this bit of code in an ASPX file:

VB.NET:
<div class="buttonContainer" style="clear:both;width:100%;text-align:left">
   <asp:Button ID="btnProceed" runat="server"  Text="Next" OnClick="ProceedButton_Clicked" Enabled="true" />
</div>
So, if I want to make the button bigger or bolder text, how would I do it?
 
All your server controls are ultimately going to render some HTML markup to the browser. So Apply a CSS class to your button and style it the way you want. You can use the CssClass property to set it.

VB.NET:
<asp:Button ID="btnProceed" runat="server" Text="Hi" CssClass="yourClass" />

And put this style in your css file which is being included in your aspx page.
VB.NET:
.yourClass{
  font-size:72px;
  font-weight:bold;
}
 
There are two ways to do this.
1. Use style property of button control to customize your button.
2. Create css script file with your desired styles and give that button this css class.
 
Back
Top