programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Tuesday, February 21, 2017

How to call .cs file from .aspx.cs file in c#?

Calling .cs (class file) from .aspx.cs (webform code behind file) in C#:

This question is very general. And is faced by almost everyone including me. So, I have tried something which will be very helpful to everyone and beginners.

To understand this let's create a new website.

Select Empty website. After writing the file name click OK button.

Right Click on the website title in the Solution Explorer -> Add -> Choose Web Form (or Add New Item) -> Write the appropriate web form name and click OK button.

Similarly, to add a class file. Right click on project title -> Add new item.

Choose Class file. Write the file name and click the Add button.

An alert box will appear, that will ask that all the class file will be added in 'App_Code' folder. Click 'Yes' button. It is not necessary; you can add your own folder. But, it's good to keep all your class file in 'App_Code' as it will keep your files well organized and easily managed.

ou can see that only your class file is added in the 'App_Code' folder.

 It not only store class file, but it can also store various other the files, such as typed data set, text files, and reports. And it will automatically compile at run-time.

 One of the important features of the App_Code folder is that only one .dll is created for the complete folder, irrespective of how many files it contains when we publish our project.

Related Post : 

1 comment:

  1. Great article about calling .cs file from .aspx.cs file in c#, nice article, keep posting?