Link to home
Start Free TrialLog in
Avatar of igotstehsolution
igotstehsolution

asked on

'_Default' does not contain a definition for (Error 46)

Actual error: Error      46      '_Default' does not contain a definition for 'RdoDomains2Reserve1' and no extension method 'RdoDomains2Reserve1' accepting a first argument of type '_Default' could be found (are you missing a using directive or an assembly reference?)      C:\Documents and Settings\Administrator.LOVEPC\My Documents\Visual Studio 2008\WebSites\MythicForm\Newweb.aspx.cs      160      31      C:\...\MythicForm\


I have been using Visual Studio for years. I am baffled by whats going on. 'RdoDomains2Reserve1 DOES EXIST in Newweb.aspx. The funny part is that the other 100 definitions are not a problem including 'RdoDomains2Reserve2' 'RdoDomains2Reserve3' 'RdoDomains2Reserve4'. Only 'RdoDomains2Reserve1' is a problem, and get this>> If I upload to website form loads with no errors. (yes I restarted my machine)

Anyways here's the code blocks. Top of Newweb.aspx:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Newweb.aspx.cs" Inherits="_Default" %>



Where RdoDomains2Reserve1 is defined:

1. <asp:TextBox runat="server" id="RdoDomains2Reserve1" class="formbox" onchange="searchSuggest();" type="text" /><span class="tip">.com</span>
<br />
2.<asp:TextBox ID="RdoDomains2Reserve2" runat="server" CssClass="formbox"></asp:TextBox>
                                    <br />
3.<asp:TextBox ID="RdoDomains2Reserve3" runat="server" CssClass="formbox"></asp:TextBox>
                                    <br />
 4.<asp:TextBox ID="RdoDomains2Reserve4" runat="server" CssClass="formbox"></asp:TextBox>




Now in Newweb.aspx.cs:

string Domain1 = this.RdoDomains2Reserve1.Text.ToString();
string Domain2 = this.RdoDomains2Reserve2.Text.ToString();
string Domain3 = this.RdoDomains2Reserve3.Text.ToString();
string Domain4 = this.RdoDomains2Reserve4.Text.ToString();



P.S. I also tried rebuilding/debugging with "onchange="searchSuggest();" type="text" out of the RdoDomains2Reserve1 asp:TextBox tag.
Avatar of Alfred A.
Alfred A.
Flag of Australia image

Hi,

Have you tried renaming the _Default name in the source and code behind, let say to Home for example (Inherits="Home" and code behind -> "public partial class Home" and then Rebuild?


Avatar of igotstehsolution
igotstehsolution

ASKER

Top of Newweb.aspx.cs:

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Net.Mail;

public partial class _Default : System.Web.UI.Page
{
All other definitions works with no problem. It is only 1 out of a whole bunch. I only started working on it again recently, you can see it working at this URL:  

http://www.mythicmarketingonline.com/mmo/test2/Newweb.aspx


I just can't test on local machine because it won't build without errors.
Hi,

What I meant is to change "_Default" to any name that you want if both Source (HTML) and Code-Behind and then Rebuild.  I encountered something similar in the past.  That is why I was suggesting this.  It is a bit silly but sometimes this things do happen unfortunately. :-)  
Ok  I changed Inherits to test and it looks like this

Newweb.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Newweb.aspx.cs" Inherits="test" %>

Newwb.aspx.cs :

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Net.Mail;

public partial class test : System.Web.UI.Page



and the errors I got were:

Error      44      Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).      C:\Documents and Settings\Administrator.LOVEPC\My Documents\Visual Studio 2008\WebSites\MythicForm\Newweb.aspx.cs      11      33      C:\...\MythicForm\

Error      45      'ASP.newweb2_aspx.GetTypeHashCode()': no suitable method found to override      c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mythicform\06d27fe5\62143413\App_Web_-lvgecpb.4.cs      5991      

Error      46      'ASP.newweb2_aspx.ProcessRequest(System.Web.HttpContext)': no suitable method found to override      c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mythicform\06d27fe5\62143413\App_Web_-lvgecpb.4.cs      5996      


What the hell is file name  App_Web_-lvgecpb.4.cs ???
Hi,

Also, is RdoDomains2Reserve1 in your aspx.designer.cs?  Is the name of the public partial class still "_Default" in the aspx.designer.cs
Hi,

OK.  Try to do this, delete all temporary files, and after this, Rebuild.

If this still doesn't work,  try to delete the Debug and Release folders in your obj folders, and then try to rebuild.
Hi,

Also, the error you got, Error 44, be sure to address the issue of namespaces when linking source and code-behind including designer.cs
This is about to sound very noobish but here goes.


I have only 2 files.

Newweb.aspx
Newweb.aspx.cs


Newweb.aspx has:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Newweb.aspx.cs" Inherits="test" %>


and

<asp:TextBox runat="server" id="RdoDomains2Reserve1" class="formbox" onchange="searchSuggest();" type="text" /><span class="tip">.com</span>
<br />




While Newweb.aspx.cs has:


using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Net.Mail;

public partial class test : System.Web.UI.Page



and


string Domain1 = this.RdoDomains2Reserve1.Text.ToString();




Does that answer your question or am I supposed to have a Newweb.aspx.designer.cs? because I don't have one of those.


ASKER CERTIFIED SOLUTION
Avatar of Alfred A.
Alfred A.
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK found the solution.

In the error logs it was always referencing to Newweb.aspx and Newweb.asp.cs.


As soon as I excluded Newweb2.aspx and Newweb2.aspx.cs it built and ran with no problems.

Errors should have said something about Newweb2.aspx if it was the problem.... I triple checked all the errors nothing about Newweb2.aspx.

In any case, problem solved!
fast
Hi,

That is good to hear then. Sometimes,  patience is needed to solve problems. :-)