How will I be able to force a newline(or a line break) in innertext
HtmlGenericControl li;
li = new HtmlGenericControl("li");
li.InnerText = sdr.GetValue(0).ToString()+"\n"+sdr.GetValue(1).ToString();
myList.Controls.Add(li);
Use <br />
html tag for line break instead of \n
and use innerHtml instead of innerText
li.InnerHtml = sdr.GetValue(0).ToString()+"<br />"+sdr.GetValue(1).ToString();
You can use with Environment.NewLine
property also.
Gets the newline string defined for this environment.
li.innerText = sdr.GetValue(0).ToString()+ Environment.NewLine +sdr.GetValue(1).ToString();
You can use li.InnerHtml
property and <br />
for next line.
li.InnerHtml = sdr.GetValue(0).ToString()+"<br />"+sdr.GetValue(1).ToString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With