Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# ASP.Net Fancy Buttons

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?

like image 348
Marco Avatar asked Dec 16 '25 14:12

Marco


2 Answers

<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.

like image 152
M. Ryan Avatar answered Dec 19 '25 05:12

M. Ryan


They are the same, you can do something like this:

<asp:Button ID="SearchButton" runat="server" CssClass="addButtonStyle" OnClick="SearchButton_Click"
            Text="Go&nbsp;" Width="60px" />

some style:
.addButtonStyle {
    border: 1px solid #e1ecfc;
    background-color: #B9D1F4;
    color: #003399;
    background-image: url(partgrad.gif);
    background-repeat: repeat-x;
}
like image 45
Henry Gao Avatar answered Dec 19 '25 03:12

Henry Gao



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!