I’d like to be able to open a text/html file and write its contents to a container, either an HTML div or an asp label would be fine. How do I go about doing this in the C# codefile for the page in question?
views:
1286answers:
1
+3
A:
You just want to stream in the file and place the text into the Label.text field:
lable1.text= System.IO.File.ReadAllText( path );
Glennular
2009-02-03 19:58:32
Great answer +1, but with a label, it's InnerText or InnerHtml.
IainMH
2009-02-03 20:15:23
Yes: the .Text property will escape things like < for you. You could also use a literal control- that may be more what you really want.
Joel Coehoorn
2009-02-03 20:22:09