0

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,

AUSteve
  • 3,238
  • 21
  • 36
van
  • 9,159
  • 19
  • 60
  • 93

2 Answers2

0

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")
Chase Florell
  • 46,378
  • 57
  • 186
  • 376
  • thanks but i am trying to do this in codebehind or the class file as its a webpart and there is no asp page. – van Jan 25 '10 at 00:23
  • you can still add attributes can you not? Sorry for not being a mind reader, are you using MVC? – Chase Florell Jan 25 '10 at 00:48
  • i should have mentioned im doing this within a webpart in sharepoint, thanks – van Jan 25 '10 at 00:52
0

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.

van
  • 9,159
  • 19
  • 60
  • 93