how do I add simple HTML to panel control which is part of a multiview control in asp.net
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.
That code looks fine. Are you sure your MultiView is displaying the correct View?
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 ;)
精彩评论