Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 952 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't access control ID in code behind

#11
Problem is you might have multiple aspx files with codefile in page directive points to same codebehind file.
It expects the same control to exists in all the aspx file linked to same code behind and thus throwing compilation error.
Reply

#12
I had the same problem today and in my case the solution was:

- Go to: `C:\Users\lenovo\AppData\Local\Temp\Temporary ASP.NET Files\`
- Delete the `Temporary ASP.NET Files` folder.
Reply

#13
**Check the namespace in all three files**. Sometimes there is a discrepancy between the namespace name in the designer.cs file and the other two files. Be sure to check that name space name match in all three files
Reply

#14
Just change the inherit property under page tag

<% Page inherit = "Project_Name.otherform"
change it to

<% Page inherit = "Project_Name.YourForm"
And you will see in form2.aspx.desginer.cs the class name is also changed and corrected.

**Let Me Explain:**
Let's Say you have 2 web forms test1.aspx and test2.aspx. You copied some piece of code from test1.aspx to test2.aspx, your test2.aspx file will use <% page tag as:

<% Page inherit = "Project_Name.test1"
which was supposed to be as:

<% Page inherit = "Project_Name.test2"
because of which your test2.aspx.designer.cs class name will be automatically changed to same as test1.aspx.designer.cs as it is a system generated file and you will be unable to use your control IDs.

After correcting your inherit property, save and Open test2.aspx.designer.cs to verify and you will see in that the class name is also changed.
it will be like:


public partial class test1
{
...

Changed in to

public partial class test2
{
...

Thanks me later ;)
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through