Avatar of dxproz232
dxproz232
 asked on

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#

Avatar of undefined
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:...

I would check that first.

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
jagssidurala

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
dxproz232

ASKER
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...
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.