views:

96

answers:

2

I have a multi view which contains a view which contains a panel. the name of this panel is "Panel1"

I have the following code and my HTML does not display in the rendered page. Any idea why this isn't working, i must be doing something wrong? sw = simple html statement, any would produce same result.

 String mstring = sw.ToString();

 Panel1.Controls.Add(new LiteralControl(mstring));

i am using dotnetnuke also, not sure if that is where the issue is.

+1  A: 

That code looks fine. Are you sure your MultiView is displaying the correct View?

womp
Yes I am sure, all other objects in the view are showing.
James Campbell
Actually I needed to add the following to my code behind:MultiView1.ActiveViewIndex = 0;
James Campbell
Given you sent me in the right direction I will treat this as the answer. thank you.
James Campbell
A: 

Can we try an alternative work around here? Just add a literal in the panel like


<asp:panel ID="panel1" runat="server"><asp:Literal ID="lit" runat="server"></asp:Literal></panel>

and then try


lit.Text = sw.ToString();

Another interesting check that can help is, sw.ToString() must have something to show. I know this check is crazy but the error is also like that ;)

lakhlaniprashant.blogspot.com
Same problem, the HTML is not rendered.
James Campbell