locked
when I publish my website it shows errors that are not errors !! RRS feed

  • Question

  • User-1123701243 posted

    Hello 

    I can't get rid of errors that are shown when I publish my website.
    Visual Studio 2015

    These errors are not errors in fact.

    For example : 
    Error 'hdnCat_Numbers' is not declared. It may be inaccessible due to its protection level.

    Error 'hdnToggle' is not declared. It may be inaccessible due to its protection level. 

    while these variables are form controls that are 100% declared in the design page (aspx).

    Saturday, May 26, 2018 12:07 PM

Answers

  • User-183374066 posted

    Can you share live site link? If you are using asp.net controls than you have to get ClientId in javascript/jquery

    $('#<%=hdnToggle.ClientID %>')

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 27, 2018 11:02 AM
  • User-1123701243 posted

    Thanks Malik for your support.

    I solved the issue.

    Actually I having a page called "parts.aspx" with code page called "parts.aspx.vb".

    At the same time , I had a copy of the page "parts.aspx" . It points to the same  above "parts.aspx.vb".

    There are many controls I added in the new "parts.aspx" page.  The code file "parts.aspx.vb" makes errors because the old page "parts.aspx" doesn't have these controls.

    For example, the hidden control variable "hdnToggle" is found in the new version of the "parts.aspx" file but not in the old one.

    Sorry for disturbing you all.

    Thanks again to you Malik

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 27, 2018 12:36 PM

All replies

  • User-183374066 posted

    If this isn't appearing on your machine than it might be Framework issue. Kindly follow link 

    https://stackoverflow.com/questions/27239115/variable-is-not-declared-it-may-be-inaccessible-due-to-its-protection-level

    Saturday, May 26, 2018 8:44 PM
  • User-1123701243 posted

    This problem happens only in one page. Other pages are having similar codes and they have no errors.

    This page is the last page I worked on. 

    It is frustrating.

    I tried changing the framework from 4.5 to 4.5.1 then to 4.0 but it is not solved.

    Sunday, May 27, 2018 9:58 AM
  • User-183374066 posted

    Can you share live site link? If you are using asp.net controls than you have to get ClientId in javascript/jquery

    $('#<%=hdnToggle.ClientID %>')

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 27, 2018 11:02 AM
  • User-1123701243 posted

    Thanks Malik for your support.

    I solved the issue.

    Actually I having a page called "parts.aspx" with code page called "parts.aspx.vb".

    At the same time , I had a copy of the page "parts.aspx" . It points to the same  above "parts.aspx.vb".

    There are many controls I added in the new "parts.aspx" page.  The code file "parts.aspx.vb" makes errors because the old page "parts.aspx" doesn't have these controls.

    For example, the hidden control variable "hdnToggle" is found in the new version of the "parts.aspx" file but not in the old one.

    Sorry for disturbing you all.

    Thanks again to you Malik

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 27, 2018 12:36 PM