如何查找在Visual Studio中使用母版页的所有页面

时间:2022-11-02 20:07:53

Is there a way to find all web pages that implement a specific master page in Visual Studio?

有没有办法找到在Visual Studio中实现特定母版页的所有网页?

I'm looking for a shortcut like shift F12 that will find all usages of a master page. When I do it on the master page class name it only takes me to the design view instead of showing all pages that use it.

我正在寻找像F12这样的快捷方式,它可以找到母版页的所有用法。当我在母版页类名上执行它时,它只需要我进入设计视图,而不是显示使用它的所有页面。

I do have Resharper if there is something in there that will help.

我确实有Resharper,如果有什么东西可以提供帮助的话。

I know that I can use the Find dialog but that is not as nice.

我知道我可以使用查找对话框,但这不是很好。

3 个解决方案

#1


0  

That would be very hard to do. You can set master pages in the aspx-files, web.config or in the Page_PreInit event, which make it impossible to know exactly which master page is going to be used.

那将是非常困难的。您可以在aspx-files,web.config或Page_PreInit事件中设置母版页,这使得无法确切知道要使用哪个母版页。

What MasterPage to you think is used here?

您认为在哪个MasterPage使用?

protected void Page_PreInit(object o)
{
  this.Master = GetMasterFromDataBase(HttpContext.Current.User.Username);
}

As you can see, there is no way to be sure which master page is really used.

如您所见,无法确定哪个母版页真正使用过。

#2


2  

You mention that the FindDialog isn't that good... and I would agree if I'm was just using the Find Next dialog. But the "Find All" will display a list of all of the pages, then you can double click on each item in the list (as it stays open).

你提到FindDialog并不是那么好......如果我只是使用Find Next对话框,我会同意。但是“全部查找”将显示所有页面的列表,然后您可以双击列表中的每个项目(因为它保持打开状态)。

Control + Shift + F (or press the folder icon with the binoculars).

Control + Shift + F(或用双筒望远镜按下文件夹图标)。

#3


1  

You have this functionality now in ReSharper 5.0.

您现在在ReSharper 5.0中拥有此功能。

#1


0  

That would be very hard to do. You can set master pages in the aspx-files, web.config or in the Page_PreInit event, which make it impossible to know exactly which master page is going to be used.

那将是非常困难的。您可以在aspx-files,web.config或Page_PreInit事件中设置母版页,这使得无法确切知道要使用哪个母版页。

What MasterPage to you think is used here?

您认为在哪个MasterPage使用?

protected void Page_PreInit(object o)
{
  this.Master = GetMasterFromDataBase(HttpContext.Current.User.Username);
}

As you can see, there is no way to be sure which master page is really used.

如您所见,无法确定哪个母版页真正使用过。

#2


2  

You mention that the FindDialog isn't that good... and I would agree if I'm was just using the Find Next dialog. But the "Find All" will display a list of all of the pages, then you can double click on each item in the list (as it stays open).

你提到FindDialog并不是那么好......如果我只是使用Find Next对话框,我会同意。但是“全部查找”将显示所有页面的列表,然后您可以双击列表中的每个项目(因为它保持打开状态)。

Control + Shift + F (or press the folder icon with the binoculars).

Control + Shift + F(或用双筒望远镜按下文件夹图标)。

#3


1  

You have this functionality now in ReSharper 5.0.

您现在在ReSharper 5.0中拥有此功能。