Script control

M

Magne Ryholt

I have made a control based on System.Web.UI.WebControls.WebControl which
override the Render method to emit a script
(by using the Page.RegisterStartupScript() method)
This works fine.

This control does not render any HTML code except the mentioned script,
therefore I would like to put the component (using VS.net 2003) on the
component tray instead of the form.
(otherwise it takes up space on thye form)

Anyone knows if this is possible ?
 
J

Jos

Magne said:
I have made a control based on System.Web.UI.WebControls.WebControl
which override the Render method to emit a script
(by using the Page.RegisterStartupScript() method)
This works fine.

This control does not render any HTML code except the mentioned
script, therefore I would like to put the component (using VS.net
2003) on the component tray instead of the form.
(otherwise it takes up space on thye form)

Anyone knows if this is possible ?

I don't think so.
To get your control in the component tray, you need to
derive from Component instead of WebControl.

But Component doesn't have a Render method.

However, you could associate your control with a class
derived from ControlDesigner, which would just emit some
small code to show in the designer. This would solve
your problem.

Look here:
http://msdn.microsoft.com/asp.net/d...s/dnaspp/html/aspnet-adddesigntimesupport.asp
 
M

Magne Ryholt

Thanks for your answer
I beleive your answer indicates to emit some HTML for showing the control in
design time, but still it will occupy space in the form designer ?
I thought it might be a possibility to make it a "component" (in the
component tray) because System.Web.UI.WebControls.WebControl inherits from
System.Web.UI.Control
which in turn inherits from (implements) IComponent, but I cannot find
anything useful there either.

Anyway, it is not a big problem, it just reminds me of the annoying way e.g.
Visual Basic 6.0 showed (runtime-invisible)components in the form and took
up some space :)
(but VB 6.0 didn't have any "component tray")
 
J

Jos

Magne said:
Thanks for your answer
I beleive your answer indicates to emit some HTML for showing the
control in
design time, but still it will occupy space in the form designer ?

Not if you make it emit an empty string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top