render textfile

A

Alexander Widera

Hi,

how can i render a (text-)file with asp-serverside-tags (and html-tags)? I
want to load this file in my page and render it.

thanks a lot,
alex
 
E

Eliyahu Goldin

You can either load the file content into one of html or server controls or
get the client to download and open it with the associated application.

In the first case choice of a control depends on what you are planning the
user to do with the file content.

Eliyahu

"Alexander Widera"
 
A

Alexander Widera

The file on the server should be a template. for example the content is:
" <p> my text is: <%# mytext%> </p> "

And this should be parsed and rendered and be shown on the sceen. Have you
an example? Or the name of the method?

alex
 
L

Laurent Bugnion

Hi,

Alexander said:
The file on the server should be a template. for example the content is:
" <p> my text is: <%# mytext%> </p> "

And this should be parsed and rendered and be shown on the sceen. Have you
an example? Or the name of the method?

alex

It's not very difficult. Use the System.IO classes to read the file in
(I like StreamReader myself), then use String.Replace to replace the
template's values, and then in the Page_Load event, use for example an
Asp:Label to render the text.

HTH,
Laurent
 
E

Eliyahu Goldin

Page.LoadTemplate

You can load a template and use it with a template-supporting control:

DataList1.AlternatingItemTemplate = LoadTemplate("newtemplate.ascx");

Eliyahu

"Alexander Widera"
 
A

Alexander Widera

thank you ... now i got it

Eliyahu Goldin said:
Page.LoadTemplate

You can load a template and use it with a template-supporting control:

DataList1.AlternatingItemTemplate = LoadTemplate("newtemplate.ascx");

Eliyahu

"Alexander Widera"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top