New Property

G

Guest

Hi,

I have created my own textbox class in order to implement some functionality
that it does not already have (it inherits the TextBox webcontrol class). In
addition, I would like to create a new property for it. Here is my problem:

TextBox server controls get rendered as input tags on client side. I have a
popup window that will need to reference the parent window's textbox (input)
and set a property that I can reference when the page does a postback from
other user interaction later.

Any idea how to implement a property that can be referenced both on client
and server side of a server control?

-Demetri
 
A

A Traveler

What i would probably do, from what i read in your post, is create your
server-side code as

Public Property MyNewProperty() As String
Get
Return MyBase.Attributes("mynewproperty")
End Get
Set(Value As String)
MyBase.Attributes("mynewproperty") = Value
End Set
End Property

In your controls constructor, also add a line
MyBase.Attributes.Add("mynewproperty","mydefaultvalue")

In client side script, you can access it by:
myClientID.getAttribute and myClientID.setAttribute functions.
See the javascript docs for those.

HTH.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top