1

Hope someone help me with this.

Is this possible in asp.net?

protected void Page_Load(object sender, EventArgs e)
{
    Control parsed = this.ParseControl(@"<% if (true){ %> <div> Show True 
                                       Content </div> <%} %>");          
    myPlaceholder.Controls.Add(parsed);    
}


<asp:View id ="myPlaceholder" runat="server" />

EDIT: and I also try this still doesn't work and others

<asp:PlaceHolder id ="myPlaceholder" runat="server" />

If this is possible how can I achieve this?.

Zaheer Ahmed
  • 28,160
  • 11
  • 74
  • 110
suangetss
  • 21
  • 4
  • 1
    can you please explain what you want to do? – Adil Mammadov Mar 15 '13 at 05:27
  • I would like to parse if else statement inside of is working. – suangetss Mar 15 '13 at 05:35
  • I don't THINK that it is possible. But can't you just do that at code? For example: string test; if (true) test = @"
    Show true content
    " else test = @"
    Show false content
    " Control parsed = this.ParseControl(test); myPlaceholder.Controls.Add(parsed);
    – Adil Mammadov Mar 15 '13 at 05:42
  • Sorry for my late reply, Thanks for your time to help me. I'm just planning to make Dynamic template Tags in ASP.net 2.0. – suangetss Mar 15 '13 at 10:04

0 Answers0