Click here to Skip to main content
11,496,146 members (602 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: ASP.NET
hello friends,

I save as my one .aspx page in after save the new page has no .cs file only .aspx file

how can i add my .cs file for .aspx file plz suggest me
Posted 16-Jul-12 21:18pm
Sebastian T Xavier at 17-Jul-12 2:19am
Are you using visual studio?
When you add a new aspx page there is one option under the page with the checkbox that Place Code in Separate File. Just check this and u get automatically get the .cs file for your aspx page.
chetan virkar at 17-Jul-12 5:55am

if you are using Visual Studio, once you add any .aspx page, the code file will also created. check in the HDD project folder, do you see the code file? if yes, then Go to solution explorer is visual studio, right click on the aspx page and click "View Code". then you will find the code file.
If you are using Visual Studio, then when you are adding a new ASPX file to your website or solution, there would be a checkbox saying Place code in separate file. If you select the checkbox, VS will create a CS file along with your ASPX file.
If you are using Visual studio then while adding the web page it gives an option to "Put Code in Separate File".

if this option is checked then only the page will contain a separate code behind .cs file. otherwise visual studio assumes that you will be putting your C# code inside the aspx page under script tags.

If you still need to add .cs file to a web page follow the conventions in this links and you should be able to ad it:[^][^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 17 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100