Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > User Control not rendered in Visual Studio

Reply
Thread Tools

User Control not rendered in Visual Studio

 
 
Brendon
Guest
Posts: n/a
 
      03-23-2005
I have created a custom composite server control. When I drag the control
from the toolbox into Visual Studio it does not display in Visual Studio,
instead it shows the littel green arrow and nothing else. When I run the
application it shows the LiteralControl that I have added. Does anyone know
what I might be missing to make it also show up in Visual Studio? I have
included the entire class that I am trying to make.

Thanks,
Brendon

[ToolboxData("<{0}:NextEvent runat=server></{0}:NextEvent>")]
public class NextEvent :
System.Web.UI.WebControls.WebControl,INamingContai ner
{
protected override void CreateChildControls()
{
Controls.Add(new LiteralControl("<h3>Enter a number : </h3>"));

}

}
 
Reply With Quote
 
 
 
 
Jason Bentley
Guest
Posts: n/a
 
      03-23-2005
Brendon, you are not using OnPreRender or Render in your control. You
won't see any output unless you do.

Jason Bentley
http://geekswithblogs.net/jbentley

 
Reply With Quote
 
 
 
 
Brendon
Guest
Posts: n/a
 
      03-23-2005
From what I have read you don't need to implement the OnPreRender or Render
if you are creating a composite web control. The function
CreateChildControls() will write all of the Rendering for you. I believe
that is why you are suppose to call EnsureChildControls(), but I do not have
any properties so I am not call that function. I was wondering if there was
a way to do a Composite control without the OnPreRender or Render methods.

Thanks and please let me know if you have any more ideas.
Brendon

"Jason Bentley" wrote:

> Brendon, you are not using OnPreRender or Render in your control. You
> won't see any output unless you do.
>
> Jason Bentley
> http://geekswithblogs.net/jbentley
>
>

 
Reply With Quote
 
Jason Bentley
Guest
Posts: n/a
 
      03-24-2005
Brendon, you are right; you do not have to use OnRender or Render. If
you want to see a visual representation of your control at design time
support and do not override the Render events you will have to
implement a designer class via System.Web.UI.Design.ControlDesigner.
Sorry. Here is a brief discussion on the topic:
http://www.mcse.ms/message1479961.html

Jason Bentley
http://geekswithblogs.net/jbentley

 
Reply With Quote
 
Brendon
Guest
Posts: n/a
 
      03-24-2005
Thank you for all of the help, I will look into a custom designer for my
control. The problem that I still see is I have a class that doesn't
implement OnRender or Render and doesn't have it's own custom designer, but
still renders in both the designer and on a web page. I will keep working
at, but thanks for the input so far Jason.

"Jason Bentley" wrote:

> Brendon, you are right; you do not have to use OnRender or Render. If
> you want to see a visual representation of your control at design time
> support and do not override the Render events you will have to
> implement a designer class via System.Web.UI.Design.ControlDesigner.
> Sorry. Here is a brief discussion on the topic:
> http://www.mcse.ms/message1479961.html
>
> Jason Bentley
> http://geekswithblogs.net/jbentley
>
>

 
Reply With Quote
 
recoil@community.nospam
Guest
Posts: n/a
 
      03-29-2005
If you are implementing your own designer and the control renders at
runtime then it very well could be that the CreateChildControls is not
getting called at design time.

Either way I would check to see if CreateControl is getting called at
design time.

 
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
Should I write Visual studio 2005 or Visual studio 2003 MCSD =?Utf-8?B?VmlqYXk=?= Microsoft Certification 14 06-30-2006 09:05 AM
Should I write Visual studio 2005 or Visual studio 2003 MCSD =?Utf-8?B?VmlqYXk=?= Microsoft Certification 0 06-29-2006 07:05 PM
Is Visual Studio Team System and Visual Studio Foundation Server are same?. Thirumalai ASP .Net 0 05-22-2006 08:48 AM
Custom User Control is not rendered inside another user control in a server table. Leeor Chernov ASP .Net 2 10-16-2005 08:35 AM
visual studio .net 2003 verses visual studio .net 2002 wh ASP .Net 2 01-16-2004 04:54 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