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

WYIWYG way for creating Custom Controls

P: n/a

Previously I used to create user controls if I wanted to use a
specific set of controls in multiple pages, however I want to deploy
my control in other applications so I thought of creating custom
controls.
Only problem is that I'm used to designing my controls in a WYSIWYG
(tm) way (i.e. using the designer and writing HTML tags). The only way
I found to create custom controls was to create controls dynamically,
set their properties and render them all using pure code, something I
find really annoying.

So my question is: Is there a way I can create custom controls using a
designer and HTML tags only (i.e. without using so many writer.Write()
statements).

Thanks,
Abdo Haji-Ali
Programmer
TechnoLead

Aug 23 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,
there is a way how to get "wysiwyg support when creating custom controls"
but it is not as easy as expected. First you need to inherit your control
from TemplateControl. Template control offers nice method called
ParseControl. You can put any well formated user control to this script and
it will create instance of user control class for you. Any ascx file can be
embedded as resource to your class library. So you can think about following
approach:

1. create new control library
2. in this library create new control by inheriting from TemplateControl
3. embedded user control (ascx) file to your control library
4. in Init handler of your custom control load resource from dll and create
user control instace by calling ParseControl
5. add created user control to controls collection

I have seen nice article about this somewhere, but I am not able to find it
now.

Regards,
Ladislav
"Abdo Haji-Ali" wrote:
>
Previously I used to create user controls if I wanted to use a
specific set of controls in multiple pages, however I want to deploy
my control in other applications so I thought of creating custom
controls.
Only problem is that I'm used to designing my controls in a WYSIWYG
(tm) way (i.e. using the designer and writing HTML tags). The only way
I found to create custom controls was to create controls dynamically,
set their properties and render them all using pure code, something I
find really annoying.

So my question is: Is there a way I can create custom controls using a
designer and HTML tags only (i.e. without using so many writer.Write()
statements).

Thanks,
Abdo Haji-Ali
Programmer
TechnoLead

Aug 23 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.