Controls that contain code: Code Blocks Not Supported

M

Microsoft

How can I develop a custom control that can then be used to display
dynamically generated data?
I have created a simple custom control which I use to reproduce the same
style box in my website repeatedly. The content for the box is placed
between the tags of the control in the aspx file.
However if I want to inject some dynamic text I get the error "code blocks
are not supported in this context", how can I get around this?

This is the HTML code that I am using to create an instance of my control.
Everything works correctly as long as the HTML code within the control tags
is vanilla HTML. I am using .NET 2 and I've enabled the ParseChildren(false)
tag to my control so as to be able to access the vanilla HTML.

===============================
<Box:ShadedBox Width="90%" BoxTitle="Registration" runat="server">
<%="hi" %>
</Box:ShadedBox>


===============================

Any help would be appreciated, I am new to this ASP.NET development having
only ever worked with ASP or PHP before now where code was permitted to be
inserted anywhere.
Regards,
Anthony Williams
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top