Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding html,javascript,css as resource and using in web control

Tags:

c#

.net

I am using a web browser control that display html page in window form now I want to embed html and javascript files and css files as resource.

like image 774
Nasir Mahmood Avatar asked Feb 20 '12 11:02

Nasir Mahmood


People also ask

What is the role of HTML JavaScript and CSS in web development?

HTML provides the basic structure of sites, which is enhanced and modified by other technologies like CSS and JavaScript. CSS is used to control presentation, formatting, and layout. JavaScript is used to control the behavior of different elements.

How do I put JavaScript and CSS in HTML?

Where should I include my JavaScript and CSS code in the HTML page – inline or external file? The typical answer is: Add JavaScript code by the end of the </body> tag and. Add CSS code in-between the <head> tags.

What is embedding in HTML?

The <embed> tag defines a container for an external resource, such as a web page, a picture, a media player, or a plug-in application.

What is HTML and CSS used for?

HTML (the Hypertext Markup Language) and CSS (Cascading Style Sheets) are two of the core technologies for building Web pages. HTML provides the structure of the page, CSS the (visual and aural) layout, for a variety of devices.


1 Answers

  • Add your resource files - HTML, CSS, JS files etc. to your Visual Studio project.
  • Select the file and goto Properties window for that file by pressing F4.
  • Set the "Build Action" property to "Embedded Resource"
  • Re-compile the application
  • Use the following answer to get the embedded resource - https://stackoverflow.com/a/3314213/10458

PS: If you have a default namespace set in your project's properties, then you will have to prefix that to the file-name. For example if your file-name is File1.html and your default namespace is MyCompany.MyProject then you will have to use GetManifestResourceStream("MyCompany.MyProject.File1.html").

like image 64
Dhwanil Shah Avatar answered Sep 21 '22 00:09

Dhwanil Shah