How to use StyleSheet and JsScript template in .Net Framework


In this article I will discuss about Stylesheet and JsScript template of .Net framework. We will learn below listed point.
(1)Why we need stylesheet file.
(2)How to create style sheet and use this file in web page.
(3)Why we need JsScript file .
(4)How to create JsScript file and use this file in web page.
Let’s start
(1)Why we need stylesheet file.
This file separate all style code related to formatting and theaming of web page. We can move all inline code of page in this file.
Benefit of this file we can easily maintain style related code and we can reuse this code over any number of web page. Reduce redundancy of code in application. We can write common code in this file and use in every page.
We can move this type of inline code in stylesheet.css file.

(2)Now I will discuss how to create stylesheet in .net framework.
Go to your web application and then right click and click on add new item.
After that you select Style sheet.css template from here.
Then you can see your stylesheet.css file in solution explorer window.

After that you can write code in stylesheet.css file. If you are beginner then you need to learn about css from CSS Basic. After that you can understand this code which I have written over here.

 Now time to use this stylesheet.css file in web page. Stylesheet.css file is called a external stylesheet file. Let’s see how we can do that.
Go to your any web page or HTML page of head section and simply drag and drop your stylesheet.css file over here or you can write this line of code in head part of web page.

After doing this you cans use stylesheet.css file code in your HTML page. I will show you how you can do it. In below screen shoot you can see I have use header class of stylesheet.css file.
 
After doing this we can see output is look like this.
(3)Why we need JsScript file.
This file contains java script and jquery code. This file also reduces redundancy of code in application. We can use this file in any number of page and application. This file called as Javascript library. We can move this type of code in JsScript file.

(4)Now I will discuss about how to create JsScript file in .Net framework.
Go to Point 2 of same article and then select JsScript.js file from here.
After that I will move above code in JsScript.js file
 After that we go for how to use this JsScript.js file in web page or HTML page.
You can do that same as stylesheet file. Simply drag and drop file from solution explorer or write this line of code.

Then I will show you how I call this function on button click.

After that we can see output after click on button of page look like this.
This article simply shows you how you can use these file in your application. You can create own stylesheet or javascript library for your web application.
Thanks for reading my article. If you like this please share in your network.
Author

Priti Kumari

I am technical blogger.I blogs at www.c-Sharpcorner.com and https://aspdotnetmyblog.blogspot.in/.

1 comment:

  1. Hi admin,

    Very informative post. Presented detailed explanation along with images.

    Thanks for the post.

    ReplyDelete