I am developing a C# ASP.Net project. And I would like to do something very similar to what is shown in the following website.
However, that is a solution for the HTML <a> tag, and I am looking for a solution for ASP.NET buttons.
What are my options?
<asp:LinkButton /> is a good choice. It is virtually identical to <asp:Button />, except it creates a form enacting hyperlink that you can put any image in it that you want to.
I stress using LinkButton instead of ImageButton because ImageButton uses different event handlers, which makes it difficult to switch back and forth between them. With Linkbuttons and Buttons, they use the same event handlers, so it's rather easy to switch between them.
They are the same, you can do something like this:
<asp:Button ID="SearchButton" runat="server" CssClass="addButtonStyle" OnClick="SearchButton_Click"
Text="Go " Width="60px" />
some style:
.addButtonStyle {
border: 1px solid #e1ecfc;
background-color: #B9D1F4;
color: #003399;
background-image: url(partgrad.gif);
background-repeat: repeat-x;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With