I created new website I had unchecked "Place code in seperate file " Now I have code within .aspx pages . I want to generate .cs from for this website. Can anyone help me out?
This: http://www.4guysfromrolla.com/webtech/100500-1.shtml is what you are looking for... any code within <script runat="server"> on your page should be placed in the code behind.
Maybe there's an easier method but this is what I would do: If the .aspx file is not in production/live yet you can do this: 1. Rename the .aspx file that does not have code-behind to something like "DefaultOLD.aspx" 2. Create a new Web Form, with the original name you had on your original file and make sure you select this time the "Place code in seperate file" 3. Open your original file, the one with the "OLD" in it's name and copy all of it's runat=server script and placed it inside the class of your new code-behind file 3. The same as #3 but this time you copy only the HTML and paste it in the newly created .aspx file's html area 4. Double check that any namespaces and/or UserControls you have registered in your original (no-codebehind) file is properly transfered into your new webform Let me know if you solved it via an easier way or are stuck in the 'process' of the previous steps
I don't think there is any easy way of doing this. You will have to manually do it by seperating the C# and HTML markup into seperate files.
1) create a new .cs file and name it something, lets call it see.cs with the namespace of Default2 or whatever is ur main namespace then edit the file so it looks like: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } Code (markup): 2) then in the aspx markup code, change <%@ Page Language="C#" %> Code (markup): to: <%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="see.cs" Inherits="Default2" %> Code (markup):