ASP.NET LinkButton CSS Adapter
Does anyone know of a CSS adapter for LinkButton control for ASP.Net 2?
Update:
We are trying to use CSS buttons. We use this approach: http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html To do this, we need to render the tags that the link button does not do.
Possible solution using an adapter
We've created an adapter for the linkbutton. Then we changed the RenderContents as follows:
protected override void Render(HtmlTextWriter writer) {
LinkButton linkButton = this.Control;
linkButton.Text = String.Concat("<span>", linkButton.Text, "</span>");
base.Render(writer);
}
This seems to work and requires minimal effort.
source to share
Possible solution using an adapter
We've created an adapter for the linkbutton. Then we changed the RenderContents as follows:
protected override void Render(HtmlTextWriter writer) {
LinkButton linkButton = this.Control;
linkButton.Text = String.Concat("<span>", linkButton.Text, "</span>");
base.Render(writer);
}
This seems to work and requires minimal effort.
source to share
Create a Web Control that inherits from LinkButton
and only overrides the method RenderContents
.
It's pretty straightforward and you don't need to duplicate any code or re-execute any functions. It is of course helpful to use the .NET Framework source to take a look at the original implementation.
source to share