Add Code Behind to Web Form

  • Thread starter Thread starter jcochran
  • Start date Start date
J

jcochran

I have a web form that I need to add a code behind to in asp.net 2.0. I
created the form without the code behind in the first place. How do I
add the code behind after the fact? I cannot find a way to do it in
Visaul Web Developer 2005.

Thanks.
Jason
 
Jason,
The easiest way to figure this out is the "common sense" way:
Just add a new WebForm that does have codebehind, and look at the @Page
directive in the ASPX (HTML) portion of the page.

Then you can do the same for your codebehind-less page, changing the class
names etc. to match.
Peter
 
How about
1. Create a new form (this will have .aspx and .cs file)
2. Cut-n-pate the code from OLD aspx to this new aspx
3. Delete the OLD aspx file
4. Rename the new aspx file to old aspx
 
Back
Top