"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

  • HT204053 using multiple apple ID's

    Should a family with multiple apple devices all use the same apple id in order to put music downloads and AP's all all devices?  We currently have 3 iphones, 1 ipad and 2 ipods!  we manage this with playlists but what about AP's?  We manage the music

  • Unable to run a java program...

    Hi. I am trying to run a server program that I have implemented, but I'm having some trouble. When I click on the run button, I get the following pop-up message: Could not find the main method. Program will exit! On the console it says the following:

  • Adobe premiere elements 11 rendering at lower bit rate than i select

    Hi, I'm using Adobe Premiere Elements 11, 64-bit Windows. I keep trying to render a project at a bit target bit rate of 10.05 MB/S (.h264 1080p MP4) but the resulting .mp4 file keeps coming out with an average bit rate of around 7000kb instead of 10,

  • Crashing bug

    On the family's Powerbook G3 running 10.3.9, Safari (v.1.3.2) has developed an annoying bug. It crashes every time a message window pops up, one of those "Are you sure...?" or other similar messages. It also freezes quite frequently. I can't do the n

  • What is a LDC field?

    Hi All, Can anyone please tell me what is a LDC field in a Sales order. This field is present in the additional data tab at item level. Regards, Shanu.


HashFlare