views:

83

answers:

1

In an ASP.NET web application using C#, when we double click on design it will go to code behind page (cs file), but problem here is, when we double click on design its going to script of source file. Why it is happening?

+1  A: 

Is there actually a matching .aspx.cs file for the page? Sounds to me like the project you're working on is a Web Site rather than an WebApplication, and the page was created without checking the "Place code in separate file".

Is there anything else in the Script section of the .aspx page? It's possible that once there is code in there, double clicking on the designer will open that instead of the code behind.

Personally, I always avoid double clicking to open the source in-case I accidentally click on a control and create a click event, rather than just opening the code - I prefer to either:

  1. Right-click on the designer and "View source"
  2. From Solution Explorer open the .cs file directly.
Zhaph - Ben Duguid