Literal control rendering empty

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Literal control rendering empty

    Hi all,

    I have a custom control with an overridden Render method. Inside this
    method I'm rendering each control in its collection using their
    RenderControl method. However, I'm running into a problem in this
    scenario:

    <myprefix:mycontrol runat="server">
    <%= SomeVariable %>
    </myprefix:mycontrol>

    The contained control is showing up in the control collection as a
    LiteralControl, but its Text property is empty. Well, it's a series of
    spaces, so it's not showing up with any content. I can put <%=
    SomeVariable %> anywhere outside my custom control and it will render
    the variable value correctly.

    Is there anything I can do to ensure the variable value is rendered?

    I hope this post makes sense!

    Thanks,

    Paul

    paul.hester@gmail.com Guest

  2. Similar Questions and Discussions

    1. Custom Control rendering
      I'm overriding the Render method in a Custom Control that inherits from WebControl. Some of the ouput code is as follows; protected override void...
    2. Ignore literal content when parsing custom control children?
      Hi, I'm sure this has been asked before... Is there a setting or attribute that I can specify on my control to tell the page parser to ignore...
    3. Problem overriding render method to format literal content of nested tags in custom control
      Peter, I was under the mistaken impression that I was already overriding CreateChildControls to create the controls with the code: protected...
    4. rendering derived control from composite control
      I am triing to load a control derived from a datagrid into a composite control so I can wrap some html around the datagrid. it renders the html in...
    5. Rendering non-composit Control
      Hello NG I'm a newbie with programming controls and this seems to me a very easy question: I had create a non composit control. Inherit from...
  3. #2

    Default Re: Literal control rendering empty

    hi Paul, in case you missed my response to this same post on WebControls
    group, here it is :

    [url]http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontro ls/browse_thread/thread/b798035825291755/c1a49e17579eb197?lnk=st&q=&rnum=1&hl=en[/url]

    Regards,
    Alessandro Zifiglio
    [url]http://www.AsyncUI.net[/url]

    <paul.hester@gmail.com> ha scritto nel messaggio
    news:1154297655.410091.153990@b28g2000cwb.googlegr oups.com...
    > Hi all,
    >
    > I have a custom control with an overridden Render method. Inside this
    > method I'm rendering each control in its collection using their
    > RenderControl method. However, I'm running into a problem in this
    > scenario:
    >
    > <myprefix:mycontrol runat="server">
    > <%= SomeVariable %>
    > </myprefix:mycontrol>
    >
    > The contained control is showing up in the control collection as a
    > LiteralControl, but its Text property is empty. Well, it's a series of
    > spaces, so it's not showing up with any content. I can put <%=
    > SomeVariable %> anywhere outside my custom control and it will render
    > the variable value correctly.
    >
    > Is there anything I can do to ensure the variable value is rendered?
    >
    > I hope this post makes sense!
    >
    > Thanks,
    >
    > Paul
    >

    Alessandro Zifiglio Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139