c# - The name control name does not exist in the current context -


i've gotten popular error message, deleting , re-adding designer page doesn't issue. when created web app deleted masterpage (infrastructure) , copied asp.net header non-site.master web app one. attempted create new web application, everytime comes site.master don't want.

so question two-pronged, there simple way create web-app without site.master, simple aspx page, cs code-behind, or if stick current web app, how clean controls on page start existing in current context?

here header of aspx page:

    <%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="visiontopcc_xref_editor.default" %>  <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head runat="server">     <title>ultipro policytech import utility</title>      <link rel="stylesheet" type="text/css" href="styles/site.css" />     <link rel="stylesheet" type="text/css" href="styles/redmond/jquery-ui-1.10.3.custom.css" />     <script type="text/javascript" src="scripts/jquery-1.9.1.js"></script>     <script type="text/javascript" src="scripts/jquery-ui-1.10.3.custom.js"></script>     <script type="text/javascript" src="scripts/clientscripts.js"></script>     <%--old header:     <%@ page title="home page" language="c#" masterpagefile="~/site.master" autoeventwireup="true"     codebehind="default.aspx.cs" inherits="visiontopcc_xref_editor._default" %>     --%> </head> 

i noticed inherits old header (see bottom of above snipet had "_" in it, adding doesn't correct problem.
i'm largely re-using code simple web app (that created else before arrival here), of "existence in context" error messages actual controls aren't in new version, initial errors 1 exist. after post question go through , rid of code in code-behind refers non-existent controls...but here couple examples of controls aspx page if helps diagnoses:

            <div id="div_xref_type">                 <asp:radiobuttonlist id="rblchooser" runat="server"  font-bold="true" autopostback="true"                     font-size="medium"  repeatdirection="horizontal"                      onselectedindexchanged="rblchooser_selectedindexchanged">                     <asp:listitem value="1">payer editor</asp:listitem>                     <asp:listitem value="2">facility editor</asp:listitem>                     <asp:listitem value="3">adt-tofrom editor</asp:listitem>                 </asp:radiobuttonlist>             </div>             <div id="div_messages" runat="server">                 <asp:label id="lbl_errormessage" forecolor="red" font-size="medium" visible="false"                       runat="server" />             </div> 

i appreciate non-"delete designer file" can offer me.

thanks,

edit: here of code generating errors (i'll put things red underline in caps):

private void bindgridview_payer()         {             bool booreturn = false;             dataset dstable;             string serr = "";             string ssql = "";         lbl_errormessage.visible = false; //hide error message if it's visible.          try         {             if (rblchooser.selectedvalue.tostring() == "1")             {                 div_payergrid.visible = true;                 div_facilitygrid.visible = false;                 div_tofromgrid.visible = false;             } 

it gives me context error everytime reference control/div aspx page...thats why didn't bother including c# code... thanks.

so question two-pronged, there simple way create web-app without site.master, simple aspx page,

yes:

  • click new project
  • select asp.net empty web application

regarding second problem

you have inherits property pointing @ old designer file:

inherits="visiontopcc_xref_editor.default"

i suspect pointing @ correct designer file fix this. explains why deleting , re-adding designer not fix problem.


Comments