I want to have an ASP.net Textbox with TAG property like VB.net windows form???

A

Annie

hello guys,

I really need to have a textbox tht has a TAG property. I don't know why the
webform doesn't have one.

Is it easy to add a new property to an existing textbox? Any examples
around?

Does it require a lot of work?

TA
 
P

Phillip Williams

Imports System.ComponentModel
Imports System.Web.UI


<DefaultProperty("Text"), ToolboxData("<{0}:Text_Box
runat=server></{0}:Text_Box>")> _
Public Class MyTextBox
Inherits System.Web.UI.WebControls.TextBox


<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Tag]()
As String
Get
If ViewState("Tag") Is Nothing Then
Return ""
Else
Return CType(ViewState("Tag"), String)
End If

End Get

Set(ByVal Value As String)
ViewState("Tag") = Value

End Set
End Property

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top