Inherited Web Label doesnt properly initialize "Text" property

Discussion in 'ASP .Net Building Controls' started by Aaron Abdis, Aug 9, 2004.

  1. Aaron Abdis

    Aaron Abdis Guest

    Hello!

    I have a control i wrote which inherits from the built in Label control in
    ASP.NET. I wrote this control to add the "for" attribute of a 'real' web
    label. It worked fine and normal. I just recently reworked it so that the
    FOR property has a drop down in the property grid which lists all the static
    controls on the page by clientid (you can still type in your own text).

    Once i added the appropriate designers and such to support the controls
    drop-down list property style, the control no longer initializes the Text
    property when you put it on a form. Normally when you drop a plain label on
    a form, it's text says "Label1" (or whatever # your up to). Now when i drop
    my label on a form though, it just comes up with blank text. So i tried
    putting "Me.Text = Me.ClientID" into the Init events, handlers or overrides
    for my label, but then of course whenever the page is opened, it just says
    "Label1".

    Why would adding a designer kill the inheritance of the Text property??

    Thanks in advance,

    - Aaron
     
    Aaron Abdis, Aug 9, 2004
    #1
    1. Advertising

  2. Aaron Abdis

    MattC Guest

    Did you still call base.OnInit in your overridden OnInit?


    "Aaron Abdis" <> wrote in message
    news:...
    > Hello!
    >
    > I have a control i wrote which inherits from the built in Label control in
    > ASP.NET. I wrote this control to add the "for" attribute of a 'real' web
    > label. It worked fine and normal. I just recently reworked it so that the
    > FOR property has a drop down in the property grid which lists all the

    static
    > controls on the page by clientid (you can still type in your own text).
    >
    > Once i added the appropriate designers and such to support the controls
    > drop-down list property style, the control no longer initializes the Text
    > property when you put it on a form. Normally when you drop a plain label

    on
    > a form, it's text says "Label1" (or whatever # your up to). Now when i

    drop
    > my label on a form though, it just comes up with blank text. So i tried
    > putting "Me.Text = Me.ClientID" into the Init events, handlers or

    overrides
    > for my label, but then of course whenever the page is opened, it just says
    > "Label1".
    >
    > Why would adding a designer kill the inheritance of the Text property??
    >
    > Thanks in advance,
    >
    > - Aaron
    >
    >
     
    MattC, Aug 17, 2004
    #2
    1. Advertising

  3. Aaron Abdis

    Aaron Abdis Guest

    Actually no, i had forgotten that. However, if that were my problem, then it
    shouldve worked fine before i had added the OnInit override. Just to make
    sure though, i put back in my override, and called base.OnInit, but it still
    did not work.



    "MattC" <> wrote in message
    news:...
    > Did you still call base.OnInit in your overridden OnInit?
    >
    >
    > "Aaron Abdis" <> wrote in message
    > news:...
    > > Hello!
    > >
    > > I have a control i wrote which inherits from the built in Label control

    in
    > > ASP.NET. I wrote this control to add the "for" attribute of a 'real' web
    > > label. It worked fine and normal. I just recently reworked it so that

    the
    > > FOR property has a drop down in the property grid which lists all the

    > static
    > > controls on the page by clientid (you can still type in your own text).
    > >
    > > Once i added the appropriate designers and such to support the controls
    > > drop-down list property style, the control no longer initializes the

    Text
    > > property when you put it on a form. Normally when you drop a plain label

    > on
    > > a form, it's text says "Label1" (or whatever # your up to). Now when i

    > drop
    > > my label on a form though, it just comes up with blank text. So i tried
    > > putting "Me.Text = Me.ClientID" into the Init events, handlers or

    > overrides
    > > for my label, but then of course whenever the page is opened, it just

    says
    > > "Label1".
    > >
    > > Why would adding a designer kill the inheritance of the Text property??
    > >
    > > Thanks in advance,
    > >
    > > - Aaron
    > >
    > >

    >
    >
     
    Aaron Abdis, Aug 19, 2004
    #3
    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. CSharpner
    Replies:
    0
    Views:
    1,145
    CSharpner
    Apr 9, 2007
  2. =?Utf-8?B?QWxleCBGaW1pbmU=?=

    IE6 doesnt render the page properly whereas IE7 does

    =?Utf-8?B?QWxleCBGaW1pbmU=?=, Aug 31, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    413
    Patrice
    Aug 31, 2007
  3. Replies:
    3
    Views:
    465
    alex23
    May 27, 2008
  4. Aaron Abdis

    Inherited Web Label doesnt properly initialize "Text" property

    Aaron Abdis, Aug 9, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    204
    Aaron Abdis
    Aug 19, 2004
  5. Knut Krueger
    Replies:
    8
    Views:
    340
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page