views:

139

answers:

2

Hi,

I have some CSS that uses lists to create 3D buttons styles similar to the link below:

http://articles.techrepublic.com.com/5100-10878_11-5323375.html

My problem is I have buttons which are server controls and thus render html buttons.

The question is how would I rewrite my button code to use lists and hyperlinks so I can apply the CSS which has been already written?

All I am doing in my button code is within the onclick event setting a string value and calling a method by passing it that string value.

I guess what I'm after is some onclick event equivalent i can hook my code into for hyperlink controls.

Many Thanks,

A: 

have you tried using the <asp:hyperlink instead of the <asp:button?

also, in your code behind, you can add multiple CssClasses by doing something like

Button1.Attributes.Add("class", "style1 style2 style3")
rockinthesixstring
thanks but i am trying to do this in codebehind or the class file as its a webpart and there is no asp page.
nav
you can still add attributes can you not? Sorry for not being a mind reader, are you using MVC?
rockinthesixstring
i should have mentioned im doing this within a webpart in sharepoint, thanks
nav
A: 

I figured this out by using the LinkButton control to render the anchor tags I needed. I also used LiteralControls to render the html list elements I needed. I then added the classes as required to the created controls.

nav