Controls that contain code: Code Blocks Not Supported

Discussion in 'ASP .Net Building Controls' started by Microsoft, Dec 14, 2005.

  1. Microsoft

    Microsoft Guest

    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
    Microsoft, Dec 14, 2005
    #1
    1. Advertising

  2. Thats interesting, why is my name Microsoft!? Should be fixed now...


    "Microsoft" <> wrote in message
    news:u93O8%...
    > 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
    >
    Anthony Williams, Dec 14, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Cantley
    Replies:
    2
    Views:
    12,045
    ant177
    Dec 14, 2005
  2. matt
    Replies:
    1
    Views:
    241
    George Ogata
    Aug 6, 2004
  3. Steven Taylor
    Replies:
    9
    Views:
    237
    Brian Candler
    Apr 27, 2009
  4. Roger Pack
    Replies:
    3
    Views:
    147
    Roger Pack
    Sep 28, 2010
  5. Jason Carlton
    Replies:
    11
    Views:
    233
    Dr J R Stockton
    Dec 8, 2009
Loading...

Share This Page