By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,710 Members | 1,613 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,710 IT Pros & Developers. It's quick & easy.

Custom web control problems in the designer pane (simple examples)

P: n/a
I have a custom control that builds what we refer to as "Formlets"
around some content in a page. These are basically content "wrapper"
sections that are tables that have a colored header and provide an
open TD with a DIV in it for the content of this formlet. (The DIV is
for DHTML to hide and show the content)

I've created a web page showing step by step the two problems I'm
encountering. This problem is much easier to see than it is to
explain.

This page is best viewed with at least a 1280x1024 resolution.
http://www.cox-internet.com/wizndaly/gg/designer.htm
Here's a summary of my two problems:

1) If I change any properties using the Properties window in the
design pane, any child controls that I had nested in my custom web
control are gone once I switch back to HTML view.

2) If I have anything other than simple text nested in my custom web
control, the designer will not render it, but it will render
everything just fine when the page runs.

The html page above will show each of these problems in more detail.
By the way, I'm running Visual Studio 2003 on Windows XP with IE 6.0.

Any help is greatly appreciated!

Thanks!
Nov 17 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
Hi,

I have followed your steps and reproduce the same symptoms. However, as my
opinion, it is not an issue of vs.net, instead, I think it is raised by
misuse of the custom control.

According to the code you provided, you authored a custom control that
exports some properties and methods. From consumer side of the custom
control, instead of putting any string between the open and close tag of
the control, we should access the public properties of the custom control
inside the open tag as follows:

<cc2:panelProblem id="PanelProblem1" style="Z-INDEX: 105; LEFT: 216px;
POSITION: absolute; TOP: 168px" runat="server" MyText="this is a formlet">

here, the custom control defined a property called MyText. To access the
property, we should use the syntax shown above.

The symptom we are discussing here occurs is because that IDE detects that
there is a misuse of the custom control and then the IDE removes it out.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #2

P: n/a
Jacob,

I guess after all that work I fell short on explaining the main purpose
of this custom control. Here is some pseudo-HTML of what a "production"
implementation of the formlet control would look like:

<formletCtl id="Formlet1" Title="Account Entry">
<table>
<tr>
<td>Account Number</td>
<td><asp:textbox.../></td>
</tr>
<tr>
...etc.
</tr>
</table>
</formletCtl>

- hardly something that could be solved with a "Text" property.

Given that, since you have recreated the problem, what do you think of
the Design view destroying my/our "Contents" when properties are toggled
in the Properties window? And what of problem 2? Any thoughts or
remedies?

Thanks,

Jason

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

P: n/a
Jacob,

I guess after all that work I fell short on explaining the main
purpose of this custom control. Here is some pseudo-HTML of what a
"production" implementation of the formlet control would look like:

<formletCtl id="Formlet1" Title="Account Entry">
<table>
<tr>
<td>Account Number</td>
<td><asp:textbox.../></td>
</tr>
<tr>
...etc.
</tr>
</table>
</formletCtl>

- hardly something that could be solved with a "Text" property.

Given that, since you have recreated the problem, what do you think of
the Design view destroying my/our "Contents" when properties are
toggled in the Properties window? And what of problem 2? Any
thoughts or remedies?

Thanks,

Jason
Nov 17 '05 #4

P: n/a
Hi Dales,

I am sorry if there is any misunderstanding.

To my knowledge, since the formlet is a custom control, we should place any
output of child controls inside the Render method of the custom control,
rather than inserting any contents between the open and close tags on the
consumer side. That is, we should move the html table above into the custom
control. What do you think about it?

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #5

P: n/a
> To my knowledge, since the formlet is a custom control, we should place any
output of child controls inside the Render method of the custom control,
rather than inserting any contents between the open and close tags on the
consumer side. That is, we should move the html table above into the custom
control. What do you think about it?


Jacob,

With all due respect, I think you're still missing the point. This
formlet control is not a composite control but what I'm referring to
as a "wrapper control".

Please read the following carefully and in it's entirety (I "DO"
appreciate you trying to help, by the way)...

The formlet is basically a fancy table within a table that will "WRAP"
whatever HTML you enclose within it's tags (see screenshots at
http://www.cox-internet.com/wizndaly/gg/designer.htm).

Our current non-.NET formlet is a VBScript class. In your ASP page,
you instantiate the formlet, set a few properties, call the
..StartFormlet() method, code your complex HTML, call the .EndFormlet()
method, and destroy the object. This is a shared component that is
used all over our intranet for a common look and feel, and the .NET
version should then be a custom web control in the GAC for our
enterprise-wide usage. I'm jumping ahead a little here...

EVERY formlet (and by "every" I mean thousands upon thousands on our
intranet) will have it's own (DIFFERENT) content. It is meant to be a
wrapper table.

In my opinion, we are trying to use our formlet custom control just as
it was intended - it's no different than a "panel" or a "label" or any
other "wrapper controls" but it renders some additional HTML for it's
opening and closing tags.

What the programmer "encloses" in their formlet is insignificant. It
should be able to simply handle this with RenderContent().

In a perfect world, this should allow the developer to drag and drop a
number of formlet controls onto the page in Design view, go to HTML
view and populate the contents, switch back to design view, see how it
will look, toggle some properties, etc. and NEVER lose the HTML they
just spent time coding.

Even with an arguably immature IDE such as VS .NET 2003, they should
still never lose the HTML they just spent time coding.

In my opinion, this is a serious bug in VS .NET, and a big hinderance
to our development of reusable components in an enterprise
environment, unless someone can tell me what I'm doing wrong in my use
of RenderContent(). For others viewing this thread, please see:

http://www.cox-internet.com/wizndaly/gg/designer.htm

Another way to look at this is as such...

I'm basically trying to create a custom control that will be a fancy
panel. A panel control will allow you nest as much HTML within it's
tags as your heart desires. If you start changing the properties of
the Panel control, you don't lose the "innerHTML" (forgive the client
side references) you just coded.

At some point in time, a Microsoft developer wrote the "panel" control
by inheriting "System.Web.UI.WebControls.WebControl" and coded the
following PSEUDOCODE in the Render subroutine:

output.write("<DIV>") 'or output.WriteBeginTag("DIV")
RenderContents() 'or is it MyBase.RenderContents()?
output.write("</DIV>") 'or output.WriteEndTag("DIV")

Here's my pseudocode formlet version:

output.write("<table class='...' cellpadding=...><tr><td><table
class='...'><tr><td>")
RenderContents()
output.write("</td></tr></table></td></tr></table>")

This is not at all the code for the formlet, but it may as well be.
There is of course some branching that determines how the formlet will
appear based on the properties set.

Again, I don't see how this is any different than the way the
Microsoft team coded their panel control or any other control that
needed to implement the RenderContent() or RenderChildren() methods to
allow these controls to be "wrapper" controls.

Thanks,

Jason
Nov 17 '05 #6

P: n/a
Jacob,

With all due respect, I think you're still missing the point. This
formlet control is not a composite control but what I'm referring to as
a "wrapper control".

Please read the following carefully and in it's entirety (I "DO"
appreciate you trying to help, by the way)...

The formlet is basically a fancy table within a table that will "WRAP"
whatever HTML you enclose within it's tags (see screenshots at
http://www.cox-internet.com/wizndaly/gg/designer.htm).

Our current non-.NET formlet is a VBScript class. In your ASP page, you
instantiate the formlet, set a few properties, call the .StartFormlet()
method, code your complex HTML, call the .EndFormlet() method, and
destroy the object. This is a shared component that is used all over
our intranet for a common look and feel, and the .NET version should
then be a custom web control in the GAC for our enterprise-wide usage.
I'm jumping ahead a little here...

EVERY formlet (and by "every" I mean thousands upon thousands on our
intranet) will have it's own (DIFFERENT) content. It is meant to be a
wrapper table.

In my opinion, we are trying to use our formlet custom control just as
it was intended - it's no different than a "panel" or a "label" or any
other "wrapper controls" but it renders some additional HTML for it's
opening and closing tags.

What the programmer "encloses" in their formlet is insignificant. It
should be able to simply handle this with RenderContent().

In a perfect world, this should allow the developer to drag and drop a
number of formlet controls onto the page in Design view, go to HTML view
and populate the contents, switch back to design view, see how it will
look, toggle some properties, etc. and NEVER lose the HTML they just
spent time coding.

Even with an arguably immature IDE such as VS .NET 2003, they should
still never lose the HTML they just spent time coding.

In my opinion, this is a serious bug in VS .NET, and a big hinderance to
our development of reusable components in an enterprise environment,
unless someone can tell me what I'm doing wrong in my use of
RenderContent(). For others viewing this thread, please see:

http://www.cox-internet.com/wizndaly/gg/designer.htm

Another way to look at this is as such...

I'm basically trying to create a custom control that will be a fancy
panel. A panel control will allow you nest as much HTML within it's
tags as your heart desires. If you start changing the properties of the
Panel control, you don't lose the "innerHTML" (forgive the client side
references) you just coded.

At some point in time, a Microsoft developer wrote the "panel" control
by inheriting "System.Web.UI.WebControls.WebControl" and coded the
following PSEUDOCODE in the Render subroutine:

output.write("<DIV>") 'or output.WriteBeginTag("DIV")
RenderContents() 'or is it MyBase.RenderContents()?
output.write("</DIV>") 'or output.WriteEndTag("DIV")

Here's my pseudocode formlet version:

output.write("<table class='...' cellpadding=...><tr><td><table
class='...'><tr><td>")
RenderContents()
output.write("</td></tr></table></td></tr></table>")

This is not at all the code for the formlet, but it may as well be.
There is of course some branching that determines how the formlet will
appear based on the properties set.

Again, I don't see how this is any different than the way the Microsoft
team coded their panel control or any other control that needed to
implement the RenderContent() or RenderChildren() methods to allow these
controls to be "wrapper" controls.

Thanks,

Jason

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #7

P: n/a
Here's the latest update...

I'm able to not "lose" my content by implementing an empty designer
class that inherits from ReadWriteControlDesigner rather than
inheriting from the generic ControlDesigner. However, I lose all
Design markup and my rich control appears as a Panel (DIV) in the
Design window. In my opinion, this is a temporary solution in that
you don't lose code, but not a good one for how I envisioned our
programmer/analysts creating and consuming reusable web components for
our intranet's common look and feel. I would love to see the
following:

1) the rendered HTML of the custom control in the Design pane
2) have the ability to drag and drop additional controls within the
formlet custom control (similar to panels)
3) not lose any content of the control when properties are toggled in
Design mode using the Properties pane
4) see the rendered HTML change when those properties change

Surely, this is possible.

When using the ReadWriteControlDesigner, I have achieved #2 and #3.
Without it, that is, my original code that I posted and that this web
page has documented (http://www.cox-internet.com/wizndaly/gg/designer.htm),
I'm achieving #1 and #4.

If there's a way to achieve 1,2,3 AND 4 - I need to know.

Thanks,

Jason
Nov 17 '05 #8

P: n/a

This is not currently a known issue with the designer so I am doing
research and escalating to our development team.

Thank you,
Greg Bybee, MCSD
Microsoft ASP.NET Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Please do not send email directly to this alias. This alias is for
newsgroup purposes only.

Nov 17 '05 #9

P: n/a
Development gave some feedback based on your description at:
http://www.cox-internet.com/wizndaly/gg/designer.htm
===========
From what I understand and can guess about this control without the full
code, it seems to be a bug in the control. There are two types of controls
- panel-like controls where the page developer adds child controls, and
composite controls where the page developer only sets properties, and the
control creates child controls dynamically. A control can't do both and get
a reasonable design-time experience.

Controls marked with ParseChildren(false), PersistChildren(true) should
also be associated with a ReadWriteControlDesigner for their designer (code
snippet indicates this isn't happening), and should not be creating child
controls programmatically (code snippet indicates the control does so).

If a control wants to create child controls programmatically, it shouldn't
have ParseChildren(false) and PersistChildren(true). In fact, the control
shouldn't need those attributes since it can inherit them from its
WebControl base class. Furthermore, from guessing a bit about the intent of
this control, it seems like the control should be implemented as a
templated control.
===========
This posting is provided "AS IS" with no warranties, and confers no rights.

Please do not send email directly to this alias. This alias is for
newsgroup purposes only.

Nov 18 '05 #10

P: n/a
> Development gave some feedback based on your description at:
http://www.cox-internet.com/wizndaly/gg/designer.htm
I didn't realize how outdated that page was. I've updated it, and the
existing Design View problems/dilemmas are listed at the bottom of
this page:

http://www.cox-internet.com/wizndaly/gg/designer.htm
===========
From what I understand and can guess about this control without the full
code, it seems to be a bug in the control. There are two types of controls
- panel-like controls where the page developer adds child controls, and
This is definitely a panel-like control
composite controls where the page developer only sets properties, and the
control creates child controls dynamically. A control can't do both and get
a reasonable design-time experience.
Ok, no problem. My outdated page had code left in it where I was
trying to mix the two, but that's been corrected now...

Controls marked with ParseChildren(false), PersistChildren(true) should
also be associated with a ReadWriteControlDesigner for their designer (code
snippet indicates this isn't happening), and should not be creating child
It is now...

controls programmatically (code snippet indicates the control does so).

If a control wants to create child controls programmatically, it shouldn't
have ParseChildren(false) and PersistChildren(true). In fact, the control
shouldn't need those attributes since it can inherit them from its
WebControl base class. Furthermore, from guessing a bit about the intent of
this control, it seems like the control should be implemented as a
templated control.
===========


Perhaps a templated control is exactly what I need. Unfortunately, I
haven't found a resource that can effectively explain how to create
them.

Thanks for looking into this. I sent you a zip file of the solution
as you requested in your email to me. I hope to hear back from you
soon.

Thanks again,

Jason
Nov 18 '05 #11

P: n/a
Hi Jason,

As I explained in my e-mail to you, I am taking over for Greg on this
issue. Can you please send the code to me? I will respond in the
newsgroup once I get info for you.

Thanks.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
From: jd****@data-tronics.com (Dales)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: Custom web control problems in the designer pane (simple examples)Date: 19 Nov 2003 08:00:45 -0800
Organization: http://groups.google.com
Lines: 52
Message-ID: <c4**************************@posting.google.com >
References: <ms**************@cpmsftngxa06.phx.gbl> <es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>NNTP-Posting-Host: 159.204.59.25
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1069257645 4415 127.0.0.1 (19 Nov 2003 16:00:45 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Wed, 19 Nov 2003 16:00:45 +0000 (UTC)
Path: cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.ed u!postnews1.
google.com!not-for-mailXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191255
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Development gave some feedback based on your description at:
http://www.cox-internet.com/wizndaly/gg/designer.htm
I didn't realize how outdated that page was. I've updated it, and the
existing Design View problems/dilemmas are listed at the bottom of
this page:

http://www.cox-internet.com/wizndaly/gg/designer.htm
===========
From what I understand and can guess about this control without the full
code, it seems to be a bug in the control. There are two types of controls - panel-like controls where the page developer adds child controls, and


This is definitely a panel-like control
composite controls where the page developer only sets properties, and the control creates child controls dynamically. A control can't do both and get a reasonable design-time experience.


Ok, no problem. My outdated page had code left in it where I was
trying to mix the two, but that's been corrected now...

Controls marked with ParseChildren(false), PersistChildren(true) should
also be associated with a ReadWriteControlDesigner for their designer (code snippet indicates this isn't happening), and should not be creating child
It is now...

controls programmatically (code snippet indicates the control does so).

If a control wants to create child controls programmatically, it

shouldn't have ParseChildren(false) and PersistChildren(true). In fact, the control shouldn't need those attributes since it can inherit them from its
WebControl base class. Furthermore, from guessing a bit about the intent of this control, it seems like the control should be implemented as a
templated control.
===========


Perhaps a templated control is exactly what I need. Unfortunately, I
haven't found a resource that can effectively explain how to create
them.

Thanks for looking into this. I sent you a zip file of the solution
as you requested in your email to me. I hope to hear back from you
soon.

Thanks again,

Jason


Nov 18 '05 #12

P: n/a
Hi Jason,

It's been many days and I haven't received your code or any word from you.
I am going to go ahead and close this issue, but if you need assistance,
please post back to this thread.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
X-Tomcat-ID: 314184656
References: <ms**************@cpmsftngxa06.phx.gbl> <es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire [MSFT])
Organization: Microsoft
Date: Fri, 21 Nov 2003 13:38:30 GMT
Subject: Re: Custom web control problems in the designer pane (simple examples)X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <Ew**************@cpmsftngxa07.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 93
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191832
NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182

Hi Jason,

As I explained in my e-mail to you, I am taking over for Greg on this
issue. Can you please send the code to me? I will respond in the
newsgroup once I get info for you.

Thanks.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
From: jd****@data-tronics.com (Dales)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: Custom web control problems in the designer pane (simpleexamples)
Date: 19 Nov 2003 08:00:45 -0800
Organization: http://groups.google.com
Lines: 52
Message-ID: <c4**************************@posting.google.com >
References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.co m>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
NNTP-Posting-Host: 159.204.59.25
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1069257645 4415 127.0.0.1 (19 Nov 2003

16:00:45 GMT)
X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Wed, 19 Nov 2003 16:00:45 +0000 (UTC)
Path:

cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFT NGXA05.phx.gbl!TK2MSFTNGP0

8.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.ed u!postnews1

Nov 18 '05 #13

P: n/a
Jim,

My company's mailsweeper software had quarantined my
outgoing mail (due to the script in an zip file) and I
didn't pay attention to the quarantine email notification
I received since I get them every few minutes due to
incoming spam. Sorry, that was my oversight.

I sent you the zip file again and I got your email that
you received it.

Thanks for opening this back up, and if you need anything
else from me, please let me know.

Jason
-----Original Message-----
Hi Jason,

It's been many days and I haven't received your code or any word from you.I am going to go ahead and close this issue, but if you need assistance,please post back to this thread.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
X-Tomcat-ID: 314184656
References: <ms**************@cpmsftngxa06.phx.gbl><es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.co m>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.co m>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire [MSFT])Organization: Microsoft
Date: Fri, 21 Nov 2003 13:38:30 GMT
Subject: Re: Custom web control problems in the designer pane (simpleexamples)
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <Ew**************@cpmsftngxa07.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 93
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.aspnet:191832NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182

Hi Jason,

As I explained in my e-mail to you, I am taking over for Greg on thisissue. Can you please send the code to me? I will respond in thenewsgroup once I get info for you.

Thanks.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: jd****@data-tronics.com (Dales)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: Custom web control problems in the designer pane (simple
examples)
Date: 19 Nov 2003 08:00:45 -0800
Organization: http://groups.google.com
Lines: 52
Message-ID:
<c4**************************@posting.google.com >References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
NNTP-Posting-Host: 159.204.59.25
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1069257645 4415 127.0.0.1 (19 Nov 200316:00:45 GMT)
X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Wed, 19 Nov 2003 16:00:45 +0000

(UTC)Path:

cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!

TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!
news.maxwell.syr.edu!postnews1.

Nov 18 '05 #14

P: n/a
Jason,

Got it. I will look into this ASAP.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Jason Daley" <an*******@discussions.microsoft.com>
Sender: "Jason Daley" <an*******@discussions.microsoft.com>
References: <ms**************@cpmsftngxa06.phx.gbl> <es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>Subject: Re: Custom web control problems in the designer pane (simple examples)Date: Tue, 25 Nov 2003 13:45:26 -0800
Lines: 113
Message-ID: <0e****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOznW+1G/TtwxIMRb6FXzIvxCBvKQ==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:192743
NNTP-Posting-Host: tk2msftngxa05.phx.gbl 10.40.1.49
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Jim,

My company's mailsweeper software had quarantined my
outgoing mail (due to the script in an zip file) and I
didn't pay attention to the quarantine email notification
I received since I get them every few minutes due to
incoming spam. Sorry, that was my oversight.

I sent you the zip file again and I got your email that
you received it.

Thanks for opening this back up, and if you need anything
else from me, please let me know.

Jason
-----Original Message-----
Hi Jason,

It's been many days and I haven't received your code or

any word from you.
I am going to go ahead and close this issue, but if you

need assistance,
please post back to this thread.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.


--------------------
X-Tomcat-ID: 314184656
References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire[MSFT])Organization: Microsoft
Date: Fri, 21 Nov 2003 13:38:30 GMT
Subject: Re: Custom web control problems in thedesigner pane (simple
examples)
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <Ew**************@cpmsftngxa07.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 93
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl

microsoft.public.dotnet.framework.aspnet:191832NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182

Hi Jason,

As I explained in my e-mail to you, I am taking overfor Greg on thisissue. Can you please send the code to me? I willrespond in thenewsgroup once I get info for you.

Thanks.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties andconfers no rights.

--------------------
From: jd****@data-tronics.com (Dales)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: Custom web control problems in thedesigner pane (simpleexamples)
Date: 19 Nov 2003 08:00:45 -0800
Organization: http://groups.google.com
Lines: 52
Message-ID:<c4**************************@posting.google.co m>References: <ms**************@cpmsftngxa06.phx.gbl>
<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.co m>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
NNTP-Posting-Host: 159.204.59.25
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1069257645 4415 127.0.0.1(19 Nov 200316:00:45 GMT)
X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Wed, 19 Nov 2003 16:00:45 +0000(UTC)Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!

TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8
.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!

news.maxwell.syr.edu!postnews1
.


Nov 18 '05 #15

P: n/a
Hi Jason,

Sorry it has taken so long on this. We've been incredibly busy the last
few weeks.

First of all, you should be overriding RenderContents and not Render. When
you are inheriting from WebControl (which you definitely want to do because
you are rendering HTML to the page), you must override one or more of the
methods below:

AddAttribute
RenderBeginTag
RenderContents
RenderEndTag

You should not override Render because if you do, you will lose the
capabilities of the WebControl class to render HTML tags. That capability
is retained when you override RenderContents.

Secondly, your control does not appear as intended (with the styles intact)
because you are linking to a style sheet in your PreRender. The designer
doesn't know about that style sheet link, so it doesn't apply the styles.
I am looking into whether we can apply those styles somehow, but I haven't
found a way yet without explicitly linking to the style sheet in the
designer.

Third, you are specifying a DesignerAttribute in your meta data, but you
should not be doing so. You don't need a DesignerAttribute because you are
not implementing a custom designer. The build-in designer for server
controls provides you with all of the functionality that you need.

I will follow-up with information on the styles as soon as I have it worked
out.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
X-Tomcat-ID: 737891285
References: <ms**************@cpmsftngxa06.phx.gbl> <es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire [MSFT])
Organization: Microsoft
Date: Wed, 26 Nov 2003 23:37:26 GMT
Subject: Re: Custom web control problems in the designer pane (simple examples)X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <V4**************@cpmsftngxa06.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 127
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:193618
NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182

Jason,

Got it. I will look into this ASAP.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Jason Daley" <an*******@discussions.microsoft.com>
Sender: "Jason Daley" <an*******@discussions.microsoft.com>
References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.co m>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.co m>
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
Subject: Re: Custom web control problems in the designer pane (simple

examples)
Date: Tue, 25 Nov 2003 13:45:26 -0800
Lines: 113
Message-ID: <0e****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOznW+1G/TtwxIMRb6FXzIvxCBvKQ==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:192743
NNTP-Posting-Host: tk2msftngxa05.phx.gbl 10.40.1.49
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Jim,

My company's mailsweeper software had quarantined my
outgoing mail (due to the script in an zip file) and I
didn't pay attention to the quarantine email notification
I received since I get them every few minutes due to
incoming spam. Sorry, that was my oversight.

I sent you the zip file again and I got your email that
you received it.

Thanks for opening this back up, and if you need anything
else from me, please let me know.

Jason
-----Original Message-----
Hi Jason,

It's been many days and I haven't received your code or

any word from you.
I am going to go ahead and close this issue, but if you

need assistance,
please post back to this thread.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.


--------------------
X-Tomcat-ID: 314184656
References: <ms**************@cpmsftngxa06.phx.gbl>
<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.co m>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.co m>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire

[MSFT])
Organization: Microsoft
Date: Fri, 21 Nov 2003 13:38:30 GMT
Subject: Re: Custom web control problems in the

designer pane (simple
examples)
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <Ew**************@cpmsftngxa07.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 93
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl

microsoft.public.dotnet.framework.aspnet:19183 2
NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182

Hi Jason,

As I explained in my e-mail to you, I am taking over

for Greg on this
issue. Can you please send the code to me? I will

respond in the
newsgroup once I get info for you.

Thanks.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.


--------------------
>From: jd****@data-tronics.com (Dales)
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Subject: Re: Custom web control problems in the

designer pane (simple
examples)
>Date: 19 Nov 2003 08:00:45 -0800
>Organization: http://groups.google.com
>Lines: 52
>Message-ID:

<c4**************************@posting.google.com >
>References: <ms**************@cpmsftngxa06.phx.gbl>
<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.c om>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
>NNTP-Posting-Host: 159.204.59.25
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: 8bit
>X-Trace: posting.google.com 1069257645 4415 127.0.0.1

(19 Nov 2003
16:00:45 GMT)
>X-Complaints-To: gr**********@google.com
>NNTP-Posting-Date: Wed, 19 Nov 2003 16:00:45 +0000

(UTC)
>Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!

TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8
.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!

news.maxwell.syr.edu!postnews1
.



Nov 18 '05 #16

P: n/a
Hi Jason,

In addition to the changes in the message below, you can implement the
following code to make your styles appear. At the end of the RenderContent
method, add the following:

If HttpContext.Current Is Nothing Then
output.Write("<LINK href=""newStyle.css"" type=""text/css""
rel=""stylesheet"">")
output.Write("<LINK href=""DTCIntraStyle.css?v5.1""
type=""text/css"" rel=""STYLESHEET"">")
End If

What this does is explicitly write out the style sheet links when you are
in the designer only. That will cause your formatting applied by your CSS
classes to persist to the page.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
X-Tomcat-ID: 541365211
References: <ms**************@cpmsftngxa06.phx.gbl> <es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>
<V4**************@cpmsftngxa06.phx.gbl>MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire [MSFT])
Organization: Microsoft
Date: Tue, 02 Dec 2003 18:08:34 GMT
Subject: Re: Custom web control problems in the designer pane (simple examples)X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <SP**************@cpmsftngxa06.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 197
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:194527
NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

Hi Jason,

Sorry it has taken so long on this. We've been incredibly busy the last
few weeks.

First of all, you should be overriding RenderContents and not Render. Whenyou are inheriting from WebControl (which you definitely want to do becauseyou are rendering HTML to the page), you must override one or more of the
methods below:

AddAttribute
RenderBeginTag
RenderContents
RenderEndTag

You should not override Render because if you do, you will lose the
capabilities of the WebControl class to render HTML tags. That capability
is retained when you override RenderContents.

Secondly, your control does not appear as intended (with the styles intact)because you are linking to a style sheet in your PreRender. The designer
doesn't know about that style sheet link, so it doesn't apply the styles.
I am looking into whether we can apply those styles somehow, but I haven't
found a way yet without explicitly linking to the style sheet in the
designer.

Third, you are specifying a DesignerAttribute in your meta data, but you
should not be doing so. You don't need a DesignerAttribute because you arenot implementing a custom designer. The build-in designer for server
controls provides you with all of the functionality that you need.

I will follow-up with information on the styles as soon as I have it workedout.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
X-Tomcat-ID: 737891285
References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.co m>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.co m>
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire [MSFT])
Organization: Microsoft
Date: Wed, 26 Nov 2003 23:37:26 GMT
Subject: Re: Custom web control problems in the designer pane (simple

examples)
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <V4**************@cpmsftngxa06.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 127
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:193618
NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182

Jason,

Got it. I will look into this ASAP.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Jason Daley" <an*******@discussions.microsoft.com>
Sender: "Jason Daley" <an*******@discussions.microsoft.com>
References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
Subject: Re: Custom web control problems in the designer pane (simple

examples)
Date: Tue, 25 Nov 2003 13:45:26 -0800
Lines: 113
Message-ID: <0e****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOznW+1G/TtwxIMRb6FXzIvxCBvKQ==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:192743NNTP-Posting-Host: tk2msftngxa05.phx.gbl 10.40.1.49
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Jim,

My company's mailsweeper software had quarantined my
outgoing mail (due to the script in an zip file) and I
didn't pay attention to the quarantine email notification
I received since I get them every few minutes due to
incoming spam. Sorry, that was my oversight.

I sent you the zip file again and I got your email that
you received it.

Thanks for opening this back up, and if you need anything
else from me, please let me know.

Jason

-----Original Message-----
Hi Jason,

It's been many days and I haven't received your code or
any word from you.
I am going to go ahead and close this issue, but if you
need assistance,
please post back to this thread.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and
confers no rights.
--------------------
>X-Tomcat-ID: 314184656
>References: <ms**************@cpmsftngxa06.phx.gbl>
<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.c om>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.c om>
>MIME-Version: 1.0
>Content-Type: text/plain
>Content-Transfer-Encoding: 7bit
>From: ja******@online.microsoft.com (Jim Cheshire
[MSFT])
>Organization: Microsoft
>Date: Fri, 21 Nov 2003 13:38:30 GMT
>Subject: Re: Custom web control problems in the
designer pane (simple
examples)
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Message-ID: <Ew**************@cpmsftngxa07.phx.gbl>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Lines: 93
>Path: cpmsftngxa07.phx.gbl
>Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.aspnet:1918 32
>NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
>
>Hi Jason,
>
>As I explained in my e-mail to you, I am taking over
for Greg on this
>issue. Can you please send the code to me? I will
respond in the
>newsgroup once I get info for you.
>
>Thanks.
>
>Jim Cheshire, MCSE, MCSD [MSFT]
>Developer Support
>ASP.NET
>ja******@online.microsoft.com
>
>This post is provided as-is with no warranties and
confers no rights.
>
>
>--------------------
>>From: jd****@data-tronics.com (Dales)
>>Newsgroups: microsoft.public.dotnet.framework.aspnet
>>Subject: Re: Custom web control problems in the
designer pane (simple
>examples)
>>Date: 19 Nov 2003 08:00:45 -0800
>>Organization: http://groups.google.com
>>Lines: 52
>>Message-ID:
<c4**************************@posting.google.co m>
>>References: <ms**************@cpmsftngxa06.phx.gbl>
><es*************@tk2msftngp13.phx.gbl>
><c4**************************@posting.google. com>
><vZ**************@cpmsftngxa06.phx.gbl>
><6a**************@cpmsftngxa06.phx.gbl>
>>NNTP-Posting-Host: 159.204.59.25
>>Content-Type: text/plain; charset=ISO-8859-1
>>Content-Transfer-Encoding: 8bit
>>X-Trace: posting.google.com 1069257645 4415 127.0.0.1
(19 Nov 2003
>16:00:45 GMT)
>>X-Complaints-To: gr**********@google.com
>>NNTP-Posting-Date: Wed, 19 Nov 2003 16:00:45 +0000
(UTC)
>>Path:
>cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!
TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8
>.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!
news.maxwell.syr.edu!postnews1
.




Nov 18 '05 #17

P: n/a
Jim,

I applied all of your suggestions and what I have now is
a control that looks perfect when I drag and drop a new
one onto the page.

However, as soon as I change a property of the control in
the design pane, I lose my contents that the
control "wraps". This problem seemed to have been fixed
by implementing a ReadWriteControlDesigner, but you
suggested I don't need to implement a designer.

When I use a designer, I'm able to add controls and HTML
to my control in the Design Pane, but my control doesn't
render - it looks like a panel. I lose it's rendering.

I need for this control to do the following:

1. Allow html and/or controls to be added either
programatically or via the Design Pane to the "contents"
of the control.

2. Graphically reflect changes when the properties are
toggled in the Design pane (it's now doing this, but
destroying my contents).

Right now it's achieving #2, but not #1, and I need both.

I'm emailing you my current solution again with the
changes you suggested.

Thanks,

Jason
-----Original Message-----
Hi Jason,

In addition to the changes in the message below, you can implement thefollowing code to make your styles appear. At the end of the RenderContentmethod, add the following:

If HttpContext.Current Is Nothing Then
output.Write("<LINK href=""newStyle.css"" type=""text/css""rel=""stylesheet"">")
output.Write("<LINK href=""DTCIntraStyle.css? v5.1""type=""text/css"" rel=""STYLESHEET"">")
End If

What this does is explicitly write out the style sheet links when you arein the designer only. That will cause your formatting applied by your CSSclasses to persist to the page.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
X-Tomcat-ID: 541365211
References: <ms**************@cpmsftngxa06.phx.gbl><es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.co m>
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.co m>
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>
<V4**************@cpmsftngxa06.phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire [MSFT])Organization: Microsoft
Date: Tue, 02 Dec 2003 18:08:34 GMT
Subject: Re: Custom web control problems in the designer pane (simpleexamples)
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <SP**************@cpmsftngxa06.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 197
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet:194527NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

Hi Jason,

Sorry it has taken so long on this. We've been incredibly busy the lastfew weeks.

First of all, you should be overriding RenderContents and not Render.When
you are inheriting from WebControl (which you
definitely want to dobecause
you are rendering HTML to the page), you must override
one or more of themethods below:

AddAttribute
RenderBeginTag
RenderContents
RenderEndTag

You should not override Render because if you do, you will lose thecapabilities of the WebControl class to render HTML tags. That capabilityis retained when you override RenderContents.

Secondly, your control does not appear as intended (with the stylesintact)
because you are linking to a style sheet in your
PreRender. The designerdoesn't know about that style sheet link, so it doesn't apply the styles.I am looking into whether we can apply those styles somehow, but I haven'tfound a way yet without explicitly linking to the style sheet in thedesigner.

Third, you are specifying a DesignerAttribute in your meta data, but youshould not be doing so. You don't need a DesignerAttribute because youare
not implementing a custom designer. The build-in
designer for servercontrols provides you with all of the functionality that you need.
I will follow-up with information on the styles as soon as I have itworked
out.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.


Nov 18 '05 #18

P: n/a
Jason,

In that case, you would be much better off implementing this as a templated
control.

This case has moved outside of what we can deal with in a newsgroup issue
and is not moving into the Advisory realm. If you need additional support
for your control, we can review the options if you'll open a case with us.

Thanks.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Jason" <an*******@discussions.microsoft.com>
Sender: "Jason" <an*******@discussions.microsoft.com>
References: <ms**************@cpmsftngxa06.phx.gbl> <es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>
<V4**************@cpmsftngxa06.phx.gbl>
<SP**************@cpmsftngxa06.phx.gbl>
<Vt**************@cpmsftngxa06.phx.gbl>Subject: Re: Custom web control problems in the designer pane (simple examples)Date: Wed, 3 Dec 2003 14:04:26 -0800
Lines: 162
Message-ID: <16****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcO56WrG2Z8bSfQYSKCvnw+SjWxiBw==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:194876
NNTP-Posting-Host: tk2msftngxs01.phx.gbl 10.40.2.125
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Jim,

I applied all of your suggestions and what I have now is
a control that looks perfect when I drag and drop a new
one onto the page.

However, as soon as I change a property of the control in
the design pane, I lose my contents that the
control "wraps". This problem seemed to have been fixed
by implementing a ReadWriteControlDesigner, but you
suggested I don't need to implement a designer.

When I use a designer, I'm able to add controls and HTML
to my control in the Design Pane, but my control doesn't
render - it looks like a panel. I lose it's rendering.

I need for this control to do the following:

1. Allow html and/or controls to be added either
programatically or via the Design Pane to the "contents"
of the control.

2. Graphically reflect changes when the properties are
toggled in the Design pane (it's now doing this, but
destroying my contents).

Right now it's achieving #2, but not #1, and I need both.

I'm emailing you my current solution again with the
changes you suggested.

Thanks,

Jason
-----Original Message-----
Hi Jason,

In addition to the changes in the message below, you can

implement the
following code to make your styles appear. At the end

of the RenderContent
method, add the following:

If HttpContext.Current Is Nothing Then
output.Write("<LINK href=""newStyle.css""

type=""text/css""
rel=""stylesheet"">")
output.Write("<LINK href=""DTCIntraStyle.css?

v5.1""
type=""text/css"" rel=""STYLESHEET"">")
End If

What this does is explicitly write out the style sheet

links when you are
in the designer only. That will cause your formatting

applied by your CSS
classes to persist to the page.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.

--------------------
X-Tomcat-ID: 541365211
References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>
<V4**************@cpmsftngxa06.phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire[MSFT])Organization: Microsoft
Date: Tue, 02 Dec 2003 18:08:34 GMT
Subject: Re: Custom web control problems in thedesigner pane (simple
examples)
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <SP**************@cpmsftngxa06.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 197
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet:194527NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

Hi Jason,

Sorry it has taken so long on this. We've beenincredibly busy the lastfew weeks.

First of all, you should be overriding RenderContentsand not Render.
When
you are inheriting from WebControl (which you

definitely want to do
because
you are rendering HTML to the page), you must override

one or more of themethods below:

AddAttribute
RenderBeginTag
RenderContents
RenderEndTag

You should not override Render because if you do, youwill lose thecapabilities of the WebControl class to render HTMLtags. That capabilityis retained when you override RenderContents.

Secondly, your control does not appear as intended(with the styles
intact)
because you are linking to a style sheet in your

PreRender. The designerdoesn't know about that style sheet link, so it doesn'tapply the styles.I am looking into whether we can apply those stylessomehow, but I haven'tfound a way yet without explicitly linking to the stylesheet in thedesigner.

Third, you are specifying a DesignerAttribute in yourmeta data, but youshould not be doing so. You don't need aDesignerAttribute because you
are
not implementing a custom designer. The build-in

designer for servercontrols provides you with all of the functionalitythat you need.
I will follow-up with information on the styles as soonas I have it
worked
out.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.



Nov 18 '05 #19

P: n/a
Jason,

In that case, you would be much better off implementing this as a templated
control.

This case has moved outside of what we can deal with in a newsgroup issue
and is not moving into the Advisory realm. If you need additional support
for your control, we can review the options if you'll open a case with us.

Thanks.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Jason" <an*******@discussions.microsoft.com>
Sender: "Jason" <an*******@discussions.microsoft.com>
References: <ms**************@cpmsftngxa06.phx.gbl> <es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>
<V4**************@cpmsftngxa06.phx.gbl>
<SP**************@cpmsftngxa06.phx.gbl>
<Vt**************@cpmsftngxa06.phx.gbl>Subject: Re: Custom web control problems in the designer pane (simple examples)Date: Wed, 3 Dec 2003 14:04:26 -0800
Lines: 162
Message-ID: <16****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcO56WrG2Z8bSfQYSKCvnw+SjWxiBw==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:194876
NNTP-Posting-Host: tk2msftngxs01.phx.gbl 10.40.2.125
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Jim,

I applied all of your suggestions and what I have now is
a control that looks perfect when I drag and drop a new
one onto the page.

However, as soon as I change a property of the control in
the design pane, I lose my contents that the
control "wraps". This problem seemed to have been fixed
by implementing a ReadWriteControlDesigner, but you
suggested I don't need to implement a designer.

When I use a designer, I'm able to add controls and HTML
to my control in the Design Pane, but my control doesn't
render - it looks like a panel. I lose it's rendering.

I need for this control to do the following:

1. Allow html and/or controls to be added either
programatically or via the Design Pane to the "contents"
of the control.

2. Graphically reflect changes when the properties are
toggled in the Design pane (it's now doing this, but
destroying my contents).

Right now it's achieving #2, but not #1, and I need both.

I'm emailing you my current solution again with the
changes you suggested.

Thanks,

Jason
-----Original Message-----
Hi Jason,

In addition to the changes in the message below, you can

implement the
following code to make your styles appear. At the end

of the RenderContent
method, add the following:

If HttpContext.Current Is Nothing Then
output.Write("<LINK href=""newStyle.css""

type=""text/css""
rel=""stylesheet"">")
output.Write("<LINK href=""DTCIntraStyle.css?

v5.1""
type=""text/css"" rel=""STYLESHEET"">")
End If

What this does is explicitly write out the style sheet

links when you are
in the designer only. That will cause your formatting

applied by your CSS
classes to persist to the page.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.

--------------------
X-Tomcat-ID: 541365211
References: <ms**************@cpmsftngxa06.phx.gbl>

<es*************@tk2msftngp13.phx.gbl>
<c4**************************@posting.google.com >
<vZ**************@cpmsftngxa06.phx.gbl>
<6a**************@cpmsftngxa06.phx.gbl>
<c4**************************@posting.google.com >
<Ew**************@cpmsftngxa07.phx.gbl>
<Gv**************@cpmsftngxa07.phx.gbl>
<0e****************************@phx.gbl>
<V4**************@cpmsftngxa06.phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ja******@online.microsoft.com (Jim Cheshire[MSFT])Organization: Microsoft
Date: Tue, 02 Dec 2003 18:08:34 GMT
Subject: Re: Custom web control problems in thedesigner pane (simple
examples)
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Message-ID: <SP**************@cpmsftngxa06.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Lines: 197
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet:194527NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

Hi Jason,

Sorry it has taken so long on this. We've beenincredibly busy the lastfew weeks.

First of all, you should be overriding RenderContentsand not Render.
When
you are inheriting from WebControl (which you

definitely want to do
because
you are rendering HTML to the page), you must override

one or more of themethods below:

AddAttribute
RenderBeginTag
RenderContents
RenderEndTag

You should not override Render because if you do, youwill lose thecapabilities of the WebControl class to render HTMLtags. That capabilityis retained when you override RenderContents.

Secondly, your control does not appear as intended(with the styles
intact)
because you are linking to a style sheet in your

PreRender. The designerdoesn't know about that style sheet link, so it doesn'tapply the styles.I am looking into whether we can apply those stylessomehow, but I haven'tfound a way yet without explicitly linking to the stylesheet in thedesigner.

Third, you are specifying a DesignerAttribute in yourmeta data, but youshould not be doing so. You don't need aDesignerAttribute because you
are
not implementing a custom designer. The build-in

designer for servercontrols provides you with all of the functionalitythat you need.
I will follow-up with information on the styles as soonas I have it
worked
out.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and

confers no rights.



Nov 18 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.