0

Here is the code (content is the name of my <div>):

foreach (Exercise ex in exs)
            {
                Label label = new Label();
                label.ID = Convert.ToString(ex.ex_id);
                label.Text = ex.ex_text;               
                TextBox textbox = new TextBox();
                textbox.Width = 100;                
                textbox.ID =Convert.ToString(ex.ex_id);
                id_counter++;
                content.Controls.Add(label);
                //content.InnerHtml += "<br />";
                content.Controls.Add(textbox);
            }

It crushes on the content.Controls.InnerHtml+="<br/>" thingy.
I tried wihtout the space in the < > it wouldn;t work either :S.
I usually use content.innerhtml though dunno why it wun work here.
I tried setting it in a variable but this wonlt work either same error.
Anyone knows why it happens ? I always use this content.inner html in my functions :S...

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by UtaChan
0

Solved
I added

content.Controls.Add(new LiteralControl("<br />"));

though I still dun get why simply adding the br as I usually do isn;t good all of a sudden it was good in all places where I didn;t deal with controls...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.