New Property

Discussion in 'ASP .Net' started by =?Utf-8?B?RGVtZXRyaQ==?=, Oct 13, 2004.

  1. 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
     
    =?Utf-8?B?RGVtZXRyaQ==?=, Oct 13, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?RGVtZXRyaQ==?=

    A Traveler Guest

    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.


    "Demetri" <> wrote in message
    news:...
    > 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 Traveler, Oct 14, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    2
    Views:
    13,983
    bruce barker
    Aug 23, 2004
  2. Matt
    Replies:
    1
    Views:
    435
    Andrew Thompson
    Aug 22, 2004
  3. Matt
    Replies:
    5
    Views:
    3,043
    Michael Winter
    Aug 25, 2004
  4. Matt
    Replies:
    3
    Views:
    224
    Bob Barrows [MVP]
    Aug 22, 2004
  5. Replies:
    2
    Views:
    468
    Thomas 'PointedEars' Lahn
    Mar 11, 2008
Loading...

Share This Page