Link to home
Create AccountLog in
Avatar of MarcGraff
MarcGraffFlag for United States of America

asked on

import html file

Good Morning Experts,

Using the code behind, how would I import an html file into a aspx page on_load?

Thanks!
   - Marc
Avatar of strickdd
strickdd
Flag of United States of America image

I'm not sure why you are interested in doing this. You can always use an include statement in the code in front.

<!-- #include virtual="/somefile.html" -->

But if you need to include it in the code behind, you can use a streamreader.
Avatar of MarcGraff

ASKER

Good Afternoon strickdd,

We have different menus depending on the user. the menus are done in html because they are used in multiple languages. The reason I need this in the codebehind is so I can pull the correct menu for the correct user.

   - Marc

ASKER CERTIFIED SOLUTION
Avatar of Argblat
Argblat

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
I wouldn't recommend using a Literal control instead of the <%=Menu_HTML%>. It is the more ".Net way" of doing things. All you have to do is set the literalObj.Text = HTMLText.

To get the HTML text just use a streamreader on whatever file you have it saved as.
Another option, which is probably even better would be to use a masterpage with the different menus in it. Have the menues be in panels and then you can set the visibility to true or false depending on the user type.
Avatar of bsdotnet
bsdotnet

SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Thanks so much! I have it up are running perfectly!