Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.aspnet.buildingcontrols
Inheriting System.Web.UI.WebControls.Image and RenderContents
Nathan Sokalski
7/29/2009 5:22:00 PM
I have a custom control that inherits System.Web.UI.WebControls.Image. When
overriding the RenderContents method, I have the following two lines of
code:
Me.ImageUrl="myurlstring"
MyBase.RenderContents(writer)
When I run the control, it renders the following:
<img src="" style="border-width:0px;" />
Why is it not rendering the ImageUrl? I did a debug, and the value is being
correctly assigned to Me.ImageUrl, but it still renders an empty src
attribute. Any ideas? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansok...
1 Answer
Nathan Sokalski
7/31/2009 4:45:00 AM
0
I found my problem. I probably should have realized this sooner (since it's
something I already knew), but it was simply the fact that the attributes in
the actual tag are rendered in the Render method, and RenderContents is only
for children and stuff between the opening and closing tags. Problem Solved!
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansok...
"Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
news:%23qxOCEHEKHA.4184@TK2MSFTNGP02.phx.gbl...
>I have a custom control that inherits System.Web.UI.WebControls.Image. When
>overriding the RenderContents method, I have the following two lines of
>code:
>
> Me.ImageUrl="myurlstring"
> MyBase.RenderContents(writer)
>
> When I run the control, it renders the following:
>
> <img src="" style="border-width:0px;" />
>
> Why is it not rendering the ImageUrl? I did a debug, and the value is
> being correctly assigned to Me.ImageUrl, but it still renders an empty src
> attribute. Any ideas? Thanks.
> --
> Nathan Sokalski
> njsokalski@hotmail.com
>
http://www.nathansok...
>
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Inheriting System.Web.UI.WebControls.Image and RenderContents
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password