16

I have this <div class='divname'>...</div> where I use this in many other pages. Instead of repeating this code can we create a html file and include it in aspx page? if yes how?

I am not using Masterpage, and my backend is vb.net

2 Answers 2

33

An alternative to include plain html in your .aspx files is to use old asp include directive, like this:

<!-- #include file="~/path/to/your-static-file.html" -->

This way you don't need to create .net controls or masterpage as you said, just include the file you already have.

Sign up to request clarification or add additional context in comments.

Comments

4

Instead of creating separate html file, you can create User Control. If you are trying to create separate html you need to specify all the tags for e.g. <html><head></head><body></body></html> etc.

In User Control you can just add your code like <div class='divname'>...</div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.