Jason
Jason

Reputation: 11363

What can cause an .aspx page to ignore its corresponding .cs file?

For a school project, I'm forced to use Visual Studio and ASP to implement an interactive course catalogue website. Due to time constraints, we're putting together a table-based design where one column implements a MultiView and the other shows a GridView.

The first MultiView implements a ListView along with a text search bar. When a user makes a selection in the ListView, the goal is to fire off the ListBox1_SelectionIndexChanged event handler, whose job is to execute a query based on the SelectedIndex.

All fine and dandy... or at least it seemed.

In practice, however, the entire .cs file is getting skipped over for some reason. I found this out when setting several breakpoints for debugging only to find out that setting breakpoints on global array declarations as well as the Page_Load methods were ignored when running the debugger.

I thought it could be something with the header of the aspx file. However, given that the aspx file is named Default.aspx and the CodeBehind field has Default.aspx.cs listed.

So, what the heck is going on here?

Upvotes: 1

Views: 224

Answers (2)

Kemal Can Kara
Kemal Can Kara

Reputation: 416

if above solution didnt help you, just try to add a new page to the folder where this page is. Then look for any differences at the very top of .aspx pages and .cs pages.

Upvotes: 0

wsanville
wsanville

Reputation: 37516

Make sure the <%@Page %> directive at the top of Default.aspx specifies the following:

Inherits="_Default" AutoEventWireup="true"

Note that the Inherits attribute refers to the partial class name in Default.aspx.cs, which will probably be called _Default.

Upvotes: 3

Related Questions