简体   繁体   中英

Find all references for user control in aspx or ascx files

I am working on asp.net website, having large number of user controls(ascx) and webforms(aspx). I am facing problem while I need to find references of any specific user control (where it is used in another controls or other webforms).

By Right click on user control's class name, and click on Find All References only finds the references that used in .cs files, it did not find the control's usage in aspx or ascx files.

Can any body suggest is there any way to find the usage of my control. or visual studio does not support any such functionality yet.

ReSharper can do this for you. Do rightclick -> "find usages" in any of the .aspx, .ascx or .cs files.

Another way is the that the ascx file must be included in the aspx file. So for example if your control file is named "testing.ascx" then in the aspx file it will say something like "~/controls/"testing.ascx". So a really easy way to see all of the files the ascx is included is, is through powershell.

I would go to the directory in powershell where your files are and then type(just insert the string of the file such as "testing" into this command and it will give you the files it is included in): GetChildItem -recurse | Select-String -pattern "string you are searching for" | group path | select name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM