Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I has a c# Webform client application which calls a WCF service hosted in IIS 7.5. Both client and service application compile without errors. When I run the client application it successfully call the service but on return crashes with the following error:

localhost:6027/WebForm1.aspx

      Server Error in '/' Application.
      Compilation Error
      Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

      Compiler Error Message: CS0103: The name 'ComboBox1' does not exist in the current context

      Source Error:


      Line 108:
      Line 109:            restoreSessionParms();  // restore parameters from previous call
      Line 110:            ComboBox1.Focus();
      Line 111:
      Line 112:            //TEMP CHECKS

      Source File: C:\Users\PatClarke-DataManage\source\repos\TiosClient\TiosClient\WebForm1.aspx.cs    Line: 110


      Compiler Warning Messages:

      Show Detailed Compiler Output:

      Show Complete Compilation Source:


  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4001.0




I also get the following warnings which I suspect are linked to the problem:
C:\Users\PatClarke-DataManage\source\repos\TiosClient\TiosClient\WebForm1.aspx.cs(2892,13): warning CS0436: The type 'WebForm1' in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\e1ab8c91\838544eb\App_Web_webform1.aspx.cs.cdcab7d2.5xamvvki.0.cs' conflicts with the imported type 'WebForm1' in 'TiosClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\e1ab8c91\838544eb\App_Web_webform1.aspx.cs.cdcab7d2.5xamvvki.0.cs'.

C:\Users\PatClarke-DataManage\source\repos\TiosClient\TiosClient\WebForm1.aspx.cs(2892,66): warning CS0436: The type 'WebForm1' in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\e1ab8c91\838544eb\App_Web_webform1.aspx.cs.cdcab7d2.5xamvvki.0.cs' conflicts with the imported type 'WebForm1' in 'TiosClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\e1ab8c91\838544eb\App_Web_webform1.aspx.cs.cdcab7d2.5xamvvki.0.cs'.



WebForm1.aspx.cs
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="WebForm1.aspx.cs" Src="WebForm1.aspx.cs" Inherits="TiosClient.WebForm1" EnableSessionState="True" EnableEventValidation="false" Async="true"%>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<!DOCTYPE html>

<html>
<head runat="server">
    <link href="Content/bootstrap.min.css" rel="stylesheet" />
    <link href="Content/bootstrap-datepicker.css" rel="stylesheet" />
    <link href="Content/general.css" rel="stylesheet" type="text/css" />
    <link href="Scripts/app/menu/menu.css" rel="stylesheet" />

    <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
 
    <script type="text/javascript" src="Scripts/app/dymo-printing.js"></script>
    <script type="text/javascript" src="Scripts/app/utils.js"></script>

    <title>TransactionName</title>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113314448-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-113314448-1');
</script>

</head>
<body>
    
    <div id="modalWIP">
        <img src="images/_generic/wip.gif" />
    </div>

    <link href="<%=GetThemeDirectoryUrl %>/theme.css" rel="stylesheet" />

    <div class="centered">
        <form id="form1" runat="server" defaultbutton="NextBtn" onsubmit="showWorkInProgress(); return true;">
            <div class="header">
                <div class="hidden">
                    <asp:HiddenField ID="loggedOnUserEnterpriseId" runat="server" />
                    <asp:HiddenField ID="loggedOnUserId" runat="server" />
                    <asp:HiddenField ID="mobileOrNonMobile" runat="server" />
             
                 </div>
                <div class="logo">
                    <img runat="server" id="logo" />
                    <asp:TextBox ID="TextBox2" runat="server" style="display: none;" Width="226px">TextBox2 default value</asp:TextBox>
                </div>
                <div class="tios-logo">
                    <img src="images/tios/tios.png" alt="Tios Logo"/>
                </div>

                <div class="gridview-menu">
                    <div class="menu-button">
                        <img src="Scripts/app/menu/menu-icon.png" alt="Tios Logo"/>
                    </div>

                    <ul class="menu-items">
                        <% if (MyRtnFromServiceParms.passedSecLvl == "9") { %>
                        <li>
                            <asp:Button ID="Button1" runat="server" OnClick="Show_Transaction" Text="Transaction" ToolTip="Press to display transaction" Width="144px" />
                        </li>
                        <li>
                            <asp:Button ID="Button2" runat="server" OnClick="Show_Variables" Text="Display Variables " ToolTip="Press to display variables" Width="144px" />
                        </li>
                        <% } %>
                        <li>
                            <asp:Button ID="btnMobileAppRegistration" runat="server" OnClick="btnMobileAppRegistration_Click" Text="Mobile App" ToolTip="Press to manage your mobile app" Width="144px" />
                        </li>
                        <li id="timeoutCountdown"></li>
                    </ul>
                </div>
                

                <div class="gridview-menu" style="display: none;">

                </div>
                
            </div>
            <div class="hidden2">
               <asp:HiddenField ID="scanPrefix" runat="server" />
               <asp:HiddenField ID="scanSuffix" runat="server" />
               <asp:HiddenField ID="scanSetting" runat="server" />
               <asp:HiddenField ID="scanPfxSfxRequired" runat="server" />
               <asp:HiddenField ID="hiddenScannedValue" runat="server" />
               
            </div>
            <asp:Label ID="Label2" runat="server" Text="Transaction Name"></asp:Label>

            <div id="ContextPanel" runat="server" class="user-info">
                <asp:Label ID="lblTransaction" runat="server" CssClass="transaction"></asp:Label>
                <asp:Label ID="lblUserName" runat="server" CssClass="username"></asp:Label>
                <asp:Label ID="lblEnvironment" runat="server" Text="Label" CssClass="environment"></asp:Label>
                <asp:Label ID="lblTime" runat="server" CssClass="time"></asp:Label>
            </div>

            <div class="gridContainer <%= TextBox1.Visible ? "" : "gridContainer-FullHeight" %>">
                <div class="gridHead"></div>
                <div class="gridBody">
                    <asp:GridView ID="GridView1" runat="server" Width="318px" AllowPaging="False" CellPadding="4" 
                            OnRowDataBound="GridView1_RowDataBound" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" 
                            ShowFooter="false" ShowHeaderWhenEmpty="True" ForeColor="#333333" OnDataBound="GridView1_SelectedIndexChanged" 
                            GridLines="Both" AutoGenerateColumns="True" HorizontalAlign="Left">
                        <AlternatingRowStyle HorizontalAlign="Left" VerticalAlign="Middle" BackColor="White" ForeColor="#284775" />
                        <Columns>
                            <asp:BoundField />
                        </Columns>
                        <EditRowStyle BackColor="#999999" />
                        <FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <PagerStyle ForeColor="White" HorizontalAlign="Center" BackColor="#284775" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                        <HeaderStyle HorizontalAlign="Left" />
                    </asp:GridView>
                    <asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
                </div>
            </div>

            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>

            <div class="footer">
                <div class="textarea">
                    <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged1" TextMode="MultiLine"></asp:TextBox>
                    <!--<asp:HiddenField ID="hiddenTextBox" runat="server" /> -->
                </div>
                <div class="prev-next">
                    <asp:Button ID="PrevBtn" CssClass="transaction_btnPrevious" runat="server" OnClick="Button1_Click" Text="Prev" />

                    <div class="footerComboInfo">
                        <asp:Label runat="server" ID="lblComboInfo" Text="Do something with this"> </asp:Label>
                    </div>

                    <div class="transaction_input">
                        <cc1:ComboBox ID="ComboBox1" runat="server" OnClientBlur="OnComboBoxBlur" OnSelectedIndexChanged="ComboBox1_SelectedIndexChanged4">
                        </cc1:ComboBox>
                        
                        <% var btnScanBarcode_Action = MyRtnFromServiceParms.passedClientKeywords.ToLower().Contains("clt-biocfmtxt") ? "confirm" : "end"; %>
                        <a id="btnScanBarcode" style="display: none;" href="tiosapplication://;scheme=tios;<%= btnScanBarcode_Action %>"  >
                            <img style="height: 42px" src="images/_generic/scan.png"  alt="Tios Logo" />
                        </a>

                        <asp:FileUpload ID="FileUpload1" runat="server"  Visible="False" CssClass="transaction_FileUpload" />
                    </div>

                    <asp:Button ID="NextBtn" CssClass="transaction_btnNext" runat="server" OnClientClick="getScreenHeight()" OnClick="Button2_Click" Text="Next" />
                </div>
            </div>
        </form>
    </div>
 
    <script  type="text/javascript">
        function OnComboBoxBlur(sender, args) {
            alert("Blur");
     args.set_cancel(true);  
 }
        </script>

   <!-- AutoClickNext:  AutoClickNextVal.ToLower().Split(',').Contains(textBoxValue),-->
    <script>
    
        var globals2 = {
            myComboText: ' ',
            autoClickNext: ' '};
        
        Sys.Application.add_load(initializePage);
        function initializePage() {
            $find('<%= ComboBox1.ClientID%>').add_propertyChanged(function (sender, event) {
                if (event.get_propertyName() == 'selectedIndex') {
                    globals2.myComboText = sender.get_textBoxControl().value;
                    $('#TextBox2').val(globals2.myComboText);
                    if(globals.autoClickNextVal !=null && globals2.myComboText !=null && globals2.myComboText !=" "); // && globals.autoClickNext!=true)
              
                    {
                        var arr = globals.autoClickNextVal.toLowerCase().split(',');
                        if (arr.indexOf(globals2.myComboText.toLowerCase()) !== -1) 
                        {
                            globals2.autoClickNext=true;
                            if(globals2.autoClickNext ){
                                setTimeout(function(){
                                    $("#NextBtn").focus().click();
                                }, 300);
                            }
                        }
                    }
                }
            })
        }
     
        var globals = {
            gridviewId: '<%=GridView1.ClientID%>',
            whoAmI: '<%=MySessionLvlValues.whatAmI %>',
            gridviewKeywords: <%= GetJSONGridKeywords %>,
            passedClientKeywords : <%= GetJSONPassedClientKeywords %>,
            innactivityLogoutUrl : '<%= ResolveUrl("~/Account/TimeoutTrigger.ashx") %>',
            inactivityAllowedSeconds : <%=MyRtnFromServiceParms.passedUserInactivityAllowedSeconds > 0 ? MyRtnFromServiceParms.passedUserInactivityAllowedSeconds.ToString() : ConfigurationManager.AppSettings["inactivityAllowedSeconds"] %>,

            autoClickNextVal:  '<%= MyRtnFromServiceParms.passedAtoClkNxtVal.ToString().ToLower().Replace("'","^") %>',  // replace any exist quotes in text
            mobileSessionId: '<%= GetMobileSessionID %>',   // tios mobile session id
                
            showCalendar: <%= MyRtnFromServiceParms.passedClientKeywords.ToLower().Contains("clt-dspcal").ToString().ToLower() %>,  // show calendar
            calendarAutoNext: <%= (!MyRtnFromServiceParms.passedClientKeywords.ToLower().Contains("clt-calnortn")).ToString().ToLower() %>,  // auto click next when date is selected from calendar
            autoClickNext: <%= MyRtnFromServiceParms.passedClientKeywords.ToLower().Contains("clt-atoclknxt").ToString().ToLower()  %> }; // auto click next when page loads
        
    </script>

   <script src="<%= ResolveUrl("~/Scripts/json2.js")%>"></script>  
   <script src="<%= ResolveUrl("~/Scripts/jquery-1.10.2.min.js")%>"></script>

   <script src="Scripts/jquery.signalR-2.2.2.min.js"></script>
    <!--<script src="/signalr/hubs"></script> -->
    
    <script src="http://80.93.26.243/TiosServiceAlias/signalr/hubs"></script>
    <script src="Scripts/app/app.bundle.js"></script>
    <script src="Scripts/app/bowser.js"></script>
    <script src="Scripts/bootstrap-datepicker.js"></script>
    <script src="Scripts/bootstrap.js"></script>

    <script>
        // show the barcode scanning icon if on a mobile device
        if(bowser.android || bowser.ios) $('#btnScanBarcode').css({ 'display': 'inline-block' });
        if(bowser.android || bowser.ios)
        {$('#mobileOrNonMobile').val("mobile")}; 
        if(!bowser.android & !bowser.ios)
        {$('#mobileOrNonMobile').val("non-Mobile")};
        // Auto click next whenever required (clt-AtoClkNxt)
        if(globals.autoClickNext ){
            setTimeout(function(){
                $("#NextBtn").focus().click();
            }, 300);
      }

        // editor should be a calendar picker when required
        setTimeout(function(){
            //the initialization of the datepicker needs to be delayed otherwise it won't get the correct selected value
            if(globals.showCalendar){
                var $txtDate = $('.transaction_input input[type=text]');
                // remove the focus from the 
                $('.transaction_input input[type=text]').click(function(){
                    $txtDate.datepicker('show');
                });

                $txtDate.datepicker({
                    format: "dd/mm/yyyy"
                })
                .on('changeDate', function(){
                    // when date changes, simulate click next
                    $('.transaction_input input[type=text]').blur();
                    if(globals.calendarAutoNext){
                        setTimeout(function(){
                            // delay needed so that the combobox control can do it's magic
                            // if this is not here, the value sent to the server will be the previously selected, not the current
                            $("#NextBtn").focus().click();
                        }, 100);                
                    }
                });
            }        
        }, 500);

        // auto click next if item selected from combobox
        $('.footer').on('click', '#ComboBox1_ComboBox1_OptionList li', function(){
            alert('test');
        });

        // The following code is catering for changes to the ComboBox1 DropDownList values (client side)
        // The selected value will be written to TextBox2 which will be invisible.

     </script>

 </body>
</html>


I have been struggling with this for weeks and still cannot find the cause. Any help would be appreciated.

What I have tried:

Looked up forums but none of the proposed solutions worked. I don't understand how I can get a successful build and then have it fail on compilation error during run in debug
Posted
Comments
Richard MacCutchan 5-Oct-19 16:05pm    
I don't know the answer, but I did notice a potential issue. You are using the IDE generated names for your controls (WebForm1, Button1, Button2, etc.) which has the potential for creating conflicts. It is always a bad idea also as it is difficult to remember what each control is supposed to represent. Try using meaningful names which will make your code clearer, especially 6 months hence when you may have to work on a far more insidious bug.

Oh, and don't assume that just because your code compiles without errors that it is logically correct.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900