when do you need .ascx files and how would you use them?

后端 未结 7 972
攒了一身酷
攒了一身酷 2020-12-07 15:27

When building a website, when would it be a good idea to use .ascx files? What exactly is the .ascx and what is it used for? Examples would help a lot thanks!

7条回答
  •  清歌不尽
    2020-12-07 16:04

    One more use of .ascx files is, they can be used for Partial Page caching in ASP.NET pages. What we have to do is to create an ascx file and then move the controls or portion of the page we need to cache into that control. Then add the @OutputCache directive in the ascx control and it will be cached separately from the parent page. It is used when you don't want to cache the whole page but only a specific portion of the page.

提交回复
热议问题