How can I force a newline (or line break) in the inner text
HtmlGenericControl li; li = new HtmlGenericControl("li"); li.InnerText = sdr.GetValue(0).ToString()+"\n"+sdr.GetValue(1).ToString(); myList.Controls.Add(li);
Use the <br /> html tag to break the line instead of \n and use innerHtml instead of innerText
<br />
\n
li.InnerHtml = sdr.GetValue(0).ToString()+"<br />"+sdr.GetValue(1).ToString();
You can also use the Environment.NewLine property.
Environment.NewLine
Returns the newline specified for this environment.
li.innerText = sdr.GetValue(0).ToString()+ Environment.NewLine +sdr.GetValue(1).ToString();
You can use the li.InnerHtml property and <br /> for the next line.
li.InnerHtml