4

i dropped a button on the form from the tool box in asp.net

i want the text of button as Add where only A from the Add should be displayed with underline.

i want to user asp button only..

we can do with html button but what about in asp.net?

thanks

Mer Hardik
  • 754
  • 3
  • 11
  • 25

2 Answers2

0

An asp.net button control is rendered as an input element in html, and you cannot style this like you are wanting. The simplest solution is to just use an html button but add the runat="server" attribute.

 <button runat="server"><u>A</u>dd</button>

Alternatively, you can create a new version of an asp.net button which renders as the button tag. See this answer How can I use the button tag with ASP.NET?

Community
  • 1
  • 1
Tim B James
  • 19,595
  • 4
  • 68
  • 96
0

As is already mentioned, the <asp:Button /> control renders markup an an <input type='submit' />

The <input /> tag is what is known as a void element and therefore cannot have content. It must always be rendered without a closing tag.

In order to achieve what you want, you can follow Tim B James advice.

Community
  • 1
  • 1
Josh
  • 43,774
  • 7
  • 97
  • 123