New page controls added are not visible in code-behind form some reason...
For some reason, all of a sudden any control I add to the HTML side with the "SERVER" identification doesn't show up in the code behind... I am not sure what happened since the controls that exist already show up just fine but anything new i add does not... I.E. i add a variable like:
<asp:DropDownList runat="server" id="ddlNewElement">
but on the c# side, ddlNewElement is not a valid element?
ASP.NETC#
Last Comment
dxproz232
8/22/2022 - Mon
roxviper
do you have a web project or a website?
AlfredRobot
I have this question before, very strange. Basically, that time i delete all the "unidentified control" from aspx page, and restart the vs2010. Then I drag the controls I want to add from toolbox to the aspx page, then it suddenly works. I don't know the reason, hope this will help.
Good luck.
BurnieP
Make sure that you didn't break your HTML tags. A malformed HTML tag can be the reason VS is not able to recognize any new controls you add. I had your problem several times and each time it was because I had an <asp: ... without the end </asp:...
Thanks everyone but nothing worked until I went into the code-behind and manually added the entry into the designer.cs file. I don't drag elements (I write the HTML manually) so that maybe why it happens to me more then usual? Anyway thanks for the solution...
BurnieP
You should never have to directly modify the designer.cs file.
I am curious to see your .aspx file. I might be able to find what tag is missing.
Now, you are putting yourself into a corner because you will have to modify the designer.cs file for every control you add in your page. Normally, everytime you save your page it is silently modifying your designer.cs file with control it sees on it. Your problem is it doesn't save your controls in the designer.cs file because it is not recognizing your new controls, because of a malformed tag.
I am even curious to see, if you save back your .aspx file if it will remove your modification to the designer.cs file.
That is not the way to go, sorry. I don't want people google-ing and find that solution as a valuable solution, because it is not.
dxproz232
ASKER
Well the funny thing is once i added the missing entry in the designer.cs file, anything i added after that worked properly...