Synchronizing Code Behind

M

Mark Fox

Hello,

In VS.NET 2003 when I add server controls to the web
form it sometimes adds their declarations to the code
behind and sometimes not. Is there a way to tell VS.NET
to parse the web form and synchronize it with the code
behind so I don't have to manually add the declarations?
Thanks for your help.
 
M

MSFT

Hi Mark Fox,

Thank you for using Microsoft Newsgroup service. Based on your description,
your problem is that you found sometimes when you add some asp.net server
controls in the ASPX page manuuly, then turn to the code-behind file, the
file doesn't synthronize with the ASPX page(the control member doestn't
appear)? Please correct me if I misunderstanding your problem.

I've tried some tests on my side and here is what I found:

In VS.NET, when you edit the ASPX, you may edit it in either the
Design-view or the HTML view. If you add controls in the Design-view and
then turn to the Code-behind file, the file will have been synthronized
with the ASPX file(the control declaraion has been added). However, if you
add a server control in the HTML-view via typing the control tags manually
and then turn to the Code-behind file immediately. It do happens that the
file is not synthorized with ASPX file(the control member declaration is
not added). It seems a existed limit the in the IDE. If you do want to
force the IDE to make synthronism between the aspx page and its code-behind
file, you can try this:

After you add server control in the HTML-view, then, don't turn to the
code-behind file at once. You need to ture to the Design-View first, if you
see the new control appear in the Design view, you can then turn to the
Code-behind file, thus, the file will have been synthronized with the ASPX
page.

Please try out the preceding suggestion to see whether it helps.


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

Mark Fox

Hello,

Thank you for your explanation. I will switch to
Design View from now on synchronize the two. Thanks
again!
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top