[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Basic question, Changes on code behind (.aspx.cs) file dosen't effect

Posted on 2009-05-15
3
Medium Priority
?
424 Views
Last Modified: 2013-11-26
Hi There,
This should be a very basic question.I just started working on an existing Visual Studio Web project, and I have to do some changes on the site.
The Web project written by ASP.NET 2.0 and C#, and I opened it with Visual Studio 2008(I didn't upgrade to higher ASP.NET).
The code is working, I can Built and Publish it.  I started do some changes on the .aspx files and re-Build and re-Publish it, it also works fine, but now I need to do some changes on the code behind (.aspx.cs files), I do the changes and re-Built the project/page but it seams my changes just ignored. I even add some garbage to some of the .aspx.cs pages and save it and then re-Build it, no error, it says it built successfully. It seems I'm missing something and it gets the code behind from somewhere else??  
What should I do to force it to compile the code behind?
Thanks  


   

0
Comment
Question by:esasan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Expert Comment

by:ddayx10
ID: 24400093
Show me this line(should be at the top of the .aspx page):
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

And the code behind (doesnt have to be all of it, but at least the class and some of the code you changed):

EX:
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         //CODE I CHANGED
    }
}

ALSO, do you have a BIN folder in your project, and is it full of .dll's? If so it's very possible the project is working from the existing .dll's and ignoring your code behind. When you publish it should make new .dll's and these would need to be placed into your projects bin folder. Or you can remove the .dll's from the BIN folder (dont delete them just move them out of the project for a test), and see if your changes begin to take effect.

dday
0
 

Author Comment

by:esasan
ID: 24400365
Hi dday,
Answer to your questions:
1.  .aspx starts with:
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="CL.aspx.cs" Inherits="ProjectName.Admin.CL" %>

2. Code behind that I changed(I changed lot`s of them like):
 public partial class ConfigList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGrid();;;;XYZ                            // (I added those garbage ;;;XYZ as an example)
            }
        }
Then I Re-Built the page, no error it works just fine.

3. ALSO, do you have a BIN folder in your project ....
Yes, there is a bin folder with: 2 .dll for AJAX, 2 file with the name same as project name one ProjectName.dll and second ProjectName.pdb,  also:
MetaBuilders.WebControls.RowSelectorColumn.dll and System.Web.Extensions.dll.
I tried to remove the ones with the ProjectName. , but if I remove them then when I try to Built I get error: ProjectName.data (or Some thing) is Missing.

Thanks  



 
0
 
LVL 20

Accepted Solution

by:
ddayx10 earned 1500 total points
ID: 24400516
OK so look at the "Inherits" from the first line, and teh classname "ConfigList" on #2.

If the .aspx page was pointing to the code behind you posted then the .aspx inherits would read:
Inherits="ConfigList"

Instead it is pointing to a namespace.class that is likely in either the app_code folder or pre-compiled into .dll's in the BIN directory.

The simple answer is to change the inherits attribute on the .aspx page to point to the class of the code behind associated with it.

This may not be a problem if you don't care about what was previously written so much, but alas you probably do. So you are going to have to find that class file and make sure it's compiling its .dll into the BIN directory.

I could be off base here but I stronly suspect it's something like this. If you cant find the class it might help you to press Ctrl-Shift-F and search for the namespace.class in your entire solution.

Good Luck. I doubt I can offer much more assistance than this, but someone else may catch on and have some ideas for you :)

dday
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question