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:

Code:
<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?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,283
Location
Sydney, Australia
Programming Experience
10+

ring

Member
Joined
Aug 26, 2013
Messages
8
Programming Experience
Beginner
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.

Code:
<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.
Code:
.yourClass{
  font-size:72px;
  font-weight:bold;
}
 

nayanpatel

Active member
Joined
Nov 18, 2016
Messages
27
Location
ahmedabad
Programming Experience
3-5
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.
 
Top Bottom