locked
Inline code in templated controls RRS feed

  • Question

  • User-1693238866 posted

    Hi, everyone.

    I want my custom templated control to support inline code blocks. eg.

    <mc:MyControl id="xxx" runat="server>
    <ItemTemplate>
    <div><%="Inline code goes here" %></div>
    </ItemTemplate>
    </mc:MyControl>

    How do I do it?

    Thank you in advance.

    P.S. I know about data binding and know that <%#SomePublicVariableDefinedOnAspxCS %> will work 
           but I really need it to be <%=SomePublicVariableDefinedOnAspxCS %>

    Monday, March 26, 2012 5:30 PM

Answers

  • User-1693238866 posted

    Forget it.

    It didn't work because I have a collection of ItemTempate and the collection "cannot be modified because the control contains code blocks"

    Being stupid is not easy Laughing

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 26, 2012 5:42 PM

All replies

  • User-1693238866 posted

    Forget it.

    It didn't work because I have a collection of ItemTempate and the collection "cannot be modified because the control contains code blocks"

    Being stupid is not easy Laughing

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 26, 2012 5:42 PM
  • User3866881 posted

    Forget it.

    It didn't work because I have a collection of ItemTempate and the collection "cannot be modified because the control contains code blocks"

    Being stupid is not easy Laughing

    Congratulations that you've solved your problem,welcome to our forum next time to share your nice solution or chat with us about ASP.NET……

    Reguards!

    Tuesday, March 27, 2012 9:39 PM