Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Design-time rendering of User Control

Reply
Thread Tools

Design-time rendering of User Control

 
 
PV
Guest
Posts: n/a
 
      10-29-2003
Like many others, I would like to replace the default "grey button" display
of my user control with something that more closely (better yet exactly)
resembles the runtime display of the control.

In an attempt to do just this, I created my own designer class for my
"Header" user control. For now, the designer just returns "<h1>Page
Header</h1" from the GetDesignTimeHtml() method. Then I added the Designer
attribute to the class definition for my Header user control's code-behind.
There is no effect in the designer.

I did a google search on this group, and have found suggestions, but not a
confirmation that it is not possible to specify a designer for a user
control. Can anybody confirm this for me? I don't see why it shouldn't
work. Other than a "code in-front" page, what is the difference between a
user control and a server control? They are just classes! Is it just
laziness on the part of Microsoft? Or is there a real issue here?

I would just avoid the situation and create a server control instead,
however the very nature of my Header is such that I would like graphic
designers to be able to modify it any time they want. Obviously a user
control is what I need.

I considered just wrapping my user control with a server control, but ...
yeach. I don't want to go there.

Suggestions?


 
Reply With Quote
 
 
 
 
PV
Guest
Posts: n/a
 
      10-29-2003
Further to this discussion, I discovered a class:
System.Web.UI.Design.UserControlDesigner

To test that it is being used by my user control, I removed my custom
"Designer" attribute, and added the following code to the Page_Load method:

System.ComponentModel.AttributeCollection attributes =
TypeDescriptor.GetAttributes(this);

DesignerAttribute myAttribute =

(DesignerAttribute)attributes[typeof(DesignerAttribute)];

this.Label1.Text = myAttribute.DesignerTypeName;

Label1 did verify (at run time) that the UserControlDesigner is attached. I
then added back in my custom designer attribute. Label1 verified that my
new attribute was applied. However, there is no effect on the design-time
environment. I even put code into the constructor of my designer to throw
an exception. Still no effect in the design-time environment. It seems my
custom designer isn't even being constructed!


"PV" <philipv-REMOVE-TO-> wrote in message
news:...
> Like many others, I would like to replace the default "grey button"

display
> of my user control with something that more closely (better yet exactly)
> resembles the runtime display of the control.
>
> In an attempt to do just this, I created my own designer class for my
> "Header" user control. For now, the designer just returns "<h1>Page
> Header</h1" from the GetDesignTimeHtml() method. Then I added the

Designer
> attribute to the class definition for my Header user control's

code-behind.
> There is no effect in the designer.
>
> I did a google search on this group, and have found suggestions, but not a
> confirmation that it is not possible to specify a designer for a user
> control. Can anybody confirm this for me? I don't see why it shouldn't
> work. Other than a "code in-front" page, what is the difference between a
> user control and a server control? They are just classes! Is it just
> laziness on the part of Microsoft? Or is there a real issue here?
>
> I would just avoid the situation and create a server control instead,
> however the very nature of my Header is such that I would like graphic
> designers to be able to modify it any time they want. Obviously a user
> control is what I need.
>
> I considered just wrapping my user control with a server control, but ...
> yeach. I don't want to go there.
>
> Suggestions?
>
>



 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      10-29-2003
"PV" <philipv-REMOVE-TO-> wrote in message
news:...
> Further to this discussion, I discovered a class:
> System.Web.UI.Design.UserControlDesigner
>
> To test that it is being used by my user control, I removed my custom
> "Designer" attribute, and added the following code to the Page_Load

method:
>
> System.ComponentModel.AttributeCollection attributes =
> TypeDescriptor.GetAttributes(this);
>
> DesignerAttribute myAttribute =
>
> (DesignerAttribute)attributes[typeof(DesignerAttribute)];
>
> this.Label1.Text = myAttribute.DesignerTypeName;
>
> Label1 did verify (at run time) that the UserControlDesigner is attached.

I
> then added back in my custom designer attribute. Label1 verified that my
> new attribute was applied. However, there is no effect on the design-time
> environment. I even put code into the constructor of my designer to throw
> an exception. Still no effect in the design-time environment. It seems

my
> custom designer isn't even being constructed!


You are correct. You can't do what you want.
--
John


 
Reply With Quote
 
JL
Guest
Posts: n/a
 
      10-30-2003

> You are correct. You can't do what you want.
> --


Ok but why? I'm curious..


 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      10-30-2003
"JL" <> wrote in message
news:O#nP#...
>
> > You are correct. You can't do what you want.
> > --

>
> Ok but why? I'm curious..


Because Microsoft said so. You'll have to ask them. They'll probably say
something like "this is a limitation of user controls, which are meant to be
convenient but not very feature-rich. These limitations can be overcome by
writing a Web Custom Control".

It would be nice if one or two of these feature limitations were removed in
version 2.
--
John


 
Reply With Quote
 
Patrice Scribe
Guest
Posts: n/a
 
      11-03-2003
Are User Control instanciated at design time ? It not it would explain the
limited desing time support....

Patrice

--

"John Saunders" <john.saunders at surfcontrol.com> a écrit dans le message
de news:...
> "JL" <> wrote in message
> news:O#nP#...
> >
> > > You are correct. You can't do what you want.
> > > --

> >
> > Ok but why? I'm curious..

>
> Because Microsoft said so. You'll have to ask them. They'll probably say
> something like "this is a limitation of user controls, which are meant to

be
> convenient but not very feature-rich. These limitations can be overcome by
> writing a Web Custom Control".
>
> It would be nice if one or two of these feature limitations were removed

in
> version 2.
> --
> John
>
>


 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      11-04-2003
I assume that they are - Controls are instantiated and User Controls are
Controls.

--
John


"Patrice Scribe" <> wrote in message
news:...
> Are User Control instanciated at design time ? It not it would explain the
> limited desing time support....
>
> Patrice
>
> --
>
> "John Saunders" <john.saunders at surfcontrol.com> a écrit dans le message
> de news:...
> > "JL" <> wrote in message
> > news:O#nP#...
> > >
> > > > You are correct. You can't do what you want.
> > > > --
> > >
> > > Ok but why? I'm curious..

> >
> > Because Microsoft said so. You'll have to ask them. They'll probably

say
> > something like "this is a limitation of user controls, which are meant

to
> be
> > convenient but not very feature-rich. These limitations can be overcome

by
> > writing a Web Custom Control".
> >
> > It would be nice if one or two of these feature limitations were removed

> in
> > version 2.
> > --
> > John
> >
> >

>



 
Reply With Quote
 
Teemu Keiski
Guest
Posts: n/a
 
      11-06-2003
Limited design-time support is just a design decision MS made with v.1. In
becoming releases one can expect to see good design-time support for user
controls as well (as is already with current version of Web Matrix).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Patrice Scribe" <> wrote in message
news:...
> Are User Control instanciated at design time ? It not it would explain the
> limited desing time support....
>
> Patrice
>
> --
>
> "John Saunders" <john.saunders at surfcontrol.com> a écrit dans le message
> de news:...
> > "JL" <> wrote in message
> > news:O#nP#...
> > >
> > > > You are correct. You can't do what you want.
> > > > --
> > >
> > > Ok but why? I'm curious..

> >
> > Because Microsoft said so. You'll have to ask them. They'll probably

say
> > something like "this is a limitation of user controls, which are meant

to
> be
> > convenient but not very feature-rich. These limitations can be overcome

by
> > writing a Web Custom Control".
> >
> > It would be nice if one or two of these feature limitations were removed

> in
> > version 2.
> > --
> > John
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
IE6 SP1 rendering vs IE6 SP2 rendering Peter Mount HTML 4 01-31-2006 08:01 AM
Bug in user control rendering? Sunny ASP .Net 2 07-03-2004 03:53 PM
Rendering user control to a string and events in it Alan Mendelevich ASP .Net 1 06-01-2004 08:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57