Why does my button point to an aspx.cs file from the wrong page?

I have a web project in Visual Studio Express 2013. Currently it has a home page and 2 form pages. The first form page, aff.aspx, works perfectly and emails the form data to me when the submit button has been clicked. My second page, adv.aspx, looks how I want it to look, but the submit button at the bottom of the form calls the aspx.cs file from aff.aspx instead of its own. How can I tell the button to call adv.aspx.cs instead of aff.aspx.cs?

Thank you in advance for any help that you can offer.

David

-------------Problems Reply------------

I've had this issue a few times.

It normally happens when an .aspx page has been renamed, but the class name hasn't been changed in all places in the new copy of the file.

So, open your .aspx page, your .aspx.cs and .aspx.cs.design files, and check that the names all refer to the new project & class name.

For example, in the following SomeWebpage.aspx page, the project (SomeProject) & class (SomeWebpage) name are mentioned twice, in the first line:

<%@ Page Language="C#" EnableViewState="false"
EnableTheming="false" StylesheetTheme=""
AutoEventWireup="true"
CodeBehind="SomeWebpage.aspx.cs"
Inherits="SomeProject.SomeWebpage" %>

.. and if that line ended with this...

Inherits="SomeProject.SomeOriginalWebpageName" %>

... then this would cause your issue.

Category:asp.net Views:0 Time:2019-02-09
Tags: asp.net

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.205 (s). 11 q(s)