"Cannot get inner content of frm1 because the contents are not literal." error in building a dynamic form within other HTML

Hi, 
I am trying to build an aspx form dynamically but I have to user some HTML tags among controls. I am getting the error "Cannot get inner content of frm1 because the contents are not literal." in my 
oForm.InnerHtml += "</fieldset>";
instruction. If I put it before adding the text and button controls to the form the error is gone. What am I doing wrong, if I want the controls to be inside a <fieldset> ... </fieldset> tag?
public void LoadForm()
HtmlForm oForm = new HtmlForm();
oForm.ID = "frm1";
oForm.Action = "";
oForm.InnerHtml += "<fieldset>";
oForm.InnerHtml += "<legend> ### TITALO ### </legend>";
HtmlInputText oText = new HtmlInputText();
oText.ID = "txt";
HtmlInputSubmit oSubmit = new HtmlInputSubmit();
oSubmit.ID = "btn";
oSubmit.Value = "submit";
oForm.Controls.Add(oText);
oForm.Controls.Add(oSubmit);
oForm.InnerHtml += "</fieldset>";
main.Controls.Add(oForm);
Thanks, regards. 
Bruno

According to articles (e.g.
http://forums.asp.net/t/939432.aspx?Panel+GroupingText), in order to include a
<fieldset>, you can use a Panel control having GroupingText
attribute. Therefore, instead of dealing with InnerHtml, try this:
var panel = new Panel { GroupingText = "### TITALO ###" };
panel.Controls.Add(oText);
panel.Controls.Add(oSubmit);
oForm.Controls.Add(panel);
main.Controls.Add(oForm);

Similar Messages

Maybe you are looking for

  • How can I delete all these photos?

    I just bought an iPad mini Retina and I noticed these photos,which are not mine. How can I delete them? Is this iCloud problem?

  • Blue screen crash

    every time i start my computer it crash in blue sreen! it occured when i login in Xp or during a session i try to click on something ...and it crash !! in the blue screen there are the same ressources which failed but there's no devices mentioned ! a

  • Update a record that has not been completely inserted in database

    Hi, I have the following requirement, that I wonder which is the best solution for this:   - in QM02, add a new task in header level, means add a new record in table QMSM   - in the meantime, make this new task completed as well. For adding a new tas

  • How to change year in iOS7 reminders?

    Hi, for some reasons (beyond my understanding) some of my tasks in "Reminders" show a reminder date from the 1971. I can easily change day and month - but I have not found out how to change the year! Please help, thank you, Christoph

  • Oracle 9i Lite on Linux

    I performed the Uncompressed and Extract the files as the directions indicated. Which made an directory named Disk1. What is the next step to install the software onto the system? Thanks, Ray