title: Bogus (Yet Crippling) "[WebElementId] is not declared" Error In VB.NET
body: <p>So I have the error mentioned in the title when I try to build my web site through the file menu. The code that causes this is below (JavaScript that appears in the body tag):</p>
  
  <pre><code>            if(editedRow != null)
              {
                  var SundayLoc = $find("&lt;%= FieldOpsScheduler_ctl00_ctl05_RCB_SunLocale.ClientID %&gt;");
                  var MondayLoc = $find("&lt;%= FieldOpsScheduler_ctl00_ctl05_RCB_MonLocale.ClientID %&gt;");
                  var TuesdayLoc = $find("&lt;%= FieldOpsScheduler_ctl00_ctl05_RCB_TuesLocale.ClientID %&gt;");
                  var WednesdayLoc = $find("&lt;%= FieldOpsScheduler_ctl00_ctl05_RCB_WedLocale.ClientID %&gt;");
                  var ThursdayLoc = $find("&lt;%= FieldOpsScheduler_ctl00_ctl05_RCB_ThursLocale.ClientID %&gt;");
                  var FridayLoc = $find("&lt;%= FieldOpsScheduler_ctl00_ctl05_RCB_FriLocale.ClientID %&gt;");
                  var SaturdayLoc = $find("&lt;%= FieldOpsScheduler_ctl00_ctl05_RCB_SatLocale.ClientID %&gt;");
  
                  if(currentCombo == "OFF" || currentCombo == "OFFICE")
                  {                
                      if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_SunActivity")
                      {
                          SundayLoc.disable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_MonActivity")
                      {
                          MondayLoc.disable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_TuesActivity")
                      {
                          TuesdayLoc.disable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_WedActivity")
                      {
                          WednesdayLoc.disable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_ThursActivity")
                      {
                          ThursdayLoc.disable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_FriActivity")
                      {
                          FridayLoc.disable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_SatActivity")
                      {
                          SaturdayLoc.disable();
                      }
  
                      sender.hideDropDown();
                  }
                  else if(currentCombo != "OFF" &amp;&amp; currentCombo != "OFFICE")
                  {
                      if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_SunActivity")
                      {
                          SundayLoc.enable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_MonActivity")
                      {
                          MondayLoc.enable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_TuesActivity")
                      {
                          TuesdayLoc.enable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_WedActivity")
                      {
                          WednesdayLoc.enable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_ThursActivity")
                      {
                          ThursdayLoc.enable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_FriActivity")
                      {
                          FridayLoc.enable();
                      }
                      else if(rcbID == "FieldOpsScheduler_ctl00_ctl05_RCB_SatActivity")
                      {
                          SaturdayLoc.enable();
                      }
  
                      sender.hideDropDown();
                  } 
              }
  </code></pre>
  
  <p>Now what's really weird (and perhaps is an underlying cause of this occurring) is that when I delete the above code, exactly half the errors pointing out those web form element ID names go away. However only half -- not all of them, which doesn't make sense seeing as I got rid of all parts of the JavaScript code that ask for the web form elements' IDs.</p>
  
  <p>After deleting all relevant JavaScript and double-clicking the remaining seven error messages in VS2005, they all take me to the very first line of code in the page, which is this:</p>
  
  <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="DistrictSchedule.aspx.vb" Inherits="FieldOperations_DistrictSchedule" %&gt;
  </code></pre>
  
  <p>Myself nor my coworker knows what the deuce is going on. When I get rid of half of the errors, at least the page will execute. However it all <em>SHOULD</em> work, judging by the code..</p>
  
  <p>Additional Error Info:
  I should mention that those web form element IDs that I'm trying to find exist ONLY when my RadGrid is in edit mode, so it would make sense that they're not originally there to begin with. Regardless, this should NOT be causing a site-crippling error, although for whatever reason it is. Lastly, the specific lines throwing the error are the ones utilizing $find, and the lines utilizing the vars that $find gets values for throw the error too.</p>
  
  <p>Whoever out there who can tell me what is going on would be a MAJOR help. I thank you in advance.</p>