Why will the ASP.NET page be blank, but for a user control (.ascx)?

I was hired to perform some maintenance on the website, and found that for each page (.aspx) there is a user control (.ascx) and only one, one-to-one, and each. aspx is empty except for the user control. I do not see this because every user control is a whole page. Is there any use for this, or is it useless? I am afraid to say that it is useless because I do not have much experience.

+6
source share
2 answers

UserControl is useful because it can be used in many places in the application. If its value is for only one page, user control loses its purpose.

User controls must be modular and designed to be easy to use on other pages.

From the sounds of the application that you support, you will need to see if the user control is unique to the page, or if the application uses the same user control and decides to move things.

+2
source

My site is structured as follows: I have several .ascx files and several .aspx files that contain only one user control.

Now there is also a special .aspx file, which is actually a one-page application on which I register each .ascx element. The reason I have .aspx files for both a single-page application and for each individual β€œpage” is because during development I mostly work on one page at a time, so I don’t have to load all other application modules . By .ascx each module in a separate .ascx file, I can make changes to the module, and the changes will easily affect the single-page version of the site, as well as the .aspx page that I use for development purposes.

Hope this helps.

+3
source

Source: https://habr.com/ru/post/922525/


All Articles