Created
September 2, 2010 14:20
-
-
Save abergs/562343 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System | |
Imports System.Collections.Generic | |
Imports System.ComponentModel | |
Imports System.Text | |
Imports System.Web | |
Imports System.Web.UI | |
Imports System.Web.UI.WebControls | |
<DefaultProperty("Text"), ToolboxData("<{0}:myBtn runat=server></{0}:myBtn>")> _ | |
Public Class myBtn | |
Inherits LinkButton | |
Private _text As String | |
Overrides Property Text As String | |
Set(ByVal value As String) | |
_text = value | |
End Set | |
Get | |
Return _text | |
End Get | |
End Property | |
Private image As New Image | |
Private _imageUrl As String | |
Public Property ImageUrl As String | |
Get | |
Return _imageUrl | |
End Get | |
Set(ByVal value As String) | |
_imageUrl = value | |
End Set | |
End Property | |
Private _innertext As New HtmlControls.HtmlGenericControl("span") | |
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) | |
MyBase.CssClass = "Btn" | |
MyBase.Render(writer) | |
End Sub | |
Protected Overrides Sub RenderContents(ByVal output As HtmlTextWriter) | |
image.ImageUrl = _imageUrl | |
If _imageUrl = "" Then image.Visible = False | |
Me.Controls.Add(image) | |
_innertext.InnerText = _text | |
Me.Controls.Add(_innertext) | |
Me.RenderChildren(output) | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment