Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Inherited Web Label doesnt properly initialize "Text" property (http://www.velocityreviews.com/forums/t756972-inherited-web-label-doesnt-properly-initialize-text-property.html)

Aaron Abdis 08-09-2004 01:38 PM

Inherited Web Label doesnt properly initialize "Text" property
 
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 08-17-2004 01:08 PM

Re: Inherited Web Label doesnt properly initialize "Text" property
 
Did you still call base.OnInit in your overridden OnInit?


"Aaron Abdis" <aabdis@yahoo.com> wrote in message
news:u0Wq3YhfEHA.592@TK2MSFTNGP11.phx.gbl...
> 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 08-19-2004 02:08 AM

Re: Inherited Web Label doesnt properly initialize "Text" property
 

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" <m@m.com> wrote in message
news:OVn7gtFhEHA.2952@TK2MSFTNGP09.phx.gbl...
> Did you still call base.OnInit in your overridden OnInit?
>
>
> "Aaron Abdis" <aabdis@yahoo.com> wrote in message
> news:u0Wq3YhfEHA.592@TK2MSFTNGP11.phx.gbl...
> > 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
> >
> >

>
>





All times are GMT. The time now is 03:37 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.