Problem Using HTML Controls in ASP.Net (with Designer)

E

E. Tom Jorgenson

I've run into a problem on a couple of projects that I think I've
identified - but would like confirmation of what I think is going on. Also
interested in any fast solutions to fix the user controls/pages that
resulted from this.

On these projects the page design was done with designers who used pure HTML
with an HTML editing tool outside of Visual Studio.

The developers then created the empty pages/user controls, copied the HTML
code into the ASP text, made some minor changes to make the pages/user
controls basically work, then went on their way. As long as the pages/user
controls weren't loaded into Designer, they seemed to function properly.
They built and ran as expected.

When these pages/user controls were opened for editing in Designer, though,
some of them behaved oddly. As soon as they were opened Visual Studio wanted
to check them out. It then made changes to the code, sometimes adding
controls that weren't wanted, sometimes other changes. A common example is
that some pages using user controls added a label definition (Label1) to the
page. Only the label declaration was added. It was never instantiated nor
used in any other way.

My suspicion is that when controls are added within the Designer or removed
that related additions and deletions are made to the associated resource
file. Since these controls were added only in the ASP code the Designer
didn't recognize that the resource files had to be updated as well - so the
code and resources were no longer in sync.

So, as long as the developer fixed the problems, built the project, and
checked the working version into SourceSafe, everything would appear to be
working properly. But the next time a developer reopened the item in the
Designer it found the resources didn't match the code and made an attempt
(adding the label) to try and fix the problem - anyway, that's my hunch.

1. Can anyone confirm to me that this is what's actually going on here?
2. If so, can you point me to an easy way to fix these files?
3. Does anyone know if the next version of Visual Studio will exhibit a
similar problem? ...Or will it be smart enough to fix it automatically?

Thank you.
 
J

JV

I can't confirm anything about VS inner workings, but I have seen similar
problems. I think this is a case of "Karate do yes, or Karate do no,
Daniel-san". Use one development tool or the other but not both?

I do know that Visual studio is nearly always reformatting the HTML of a
page when you open it in the designer. Sometimes it does a good job, but
plenty of times it messes up your nicely formatted html (annoying if you did
it by hand). Maybe with XHTML it can do a better job, but I haven't had
time to check out 2.0.

It also does a number of other things. I am not sure exactly what it does
with the .res file, but it definitely does try to keep those things in
synch. At least for C# it may also generate class variables for the form if
you have any controls which have the ID field set and runat="server"
declared.

It probably does other arcane things of which I am not aware.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top