boilers222
boilers222

Reputation: 1989

Finding what method is called

I have an ASPX page with no code behind (that is, no .aspx.cs with the same name). In the code is this line:

<div style="overflow: hidden; text-align: center; z-index: 105;">
    <%= MainNavBarHTML %><%= SubNavBarHTML %>
</div>

I've searched the rest of the program for MainNavBarHTML and SubNavBarHTMl, but can't find any reference to them. How do I find what fills those elements?

Upvotes: 3

Views: 120

Answers (4)

avb
avb

Reputation: 1558

In Visual Studio, Put your cursor on the text and press F12 to jump to definition or right-click on the text and choose "Go to definition".

Upvotes: 2

Darren Wainwright
Darren Wainwright

Reputation: 30727

Adding this as an answer now (rather than in the comments).

Your project will have the code somewhere, though it may be part of another library (DLL).

If you right-click on the property (in this case either MainNavBarHTML or SubNavBarHTML, and from the context-menu select "Go to definition" VS will show you either the code (if it's in a *.cs page) or load the object browser and navigate to that property, allowing you to see exactly where the property is located.

Depending on your VS settings F12 may do nothing - does nothing on mine for example. Right-clicking and choosing "Go to definition" is the most stable way to navigate - in my opinion.

Upvotes: 0

Nathan
Nathan

Reputation: 25006

Boiler, the code is still there, you just have to select the file and hit F7 and you will see the code...

Upvotes: -2

Yuck
Yuck

Reputation: 50825

You might want to check out the CodeFile vs CodeBehind question.

If your ASPX markup has the CodeFile directive, it will look for the associated .cs file:

<%@ Page
    Language="C#"
    CodeFile="CustomerDetail.aspx.cs"
    Inherits="SomePage" %>

If, instead, it has the CodeBehind directive listed it will look in the Bin folder for an assembly that has the class defined:

<%@ Page
    Language="C#"
    CodeBehind="CustomerDetail.aspx.cs"
    Inherits="SomePage" %>

The naming of these two directives is beyond unfortunate. If the application is using CodeBehind (which it sounds like it is) you may not have access to the source and will be unable to view the definition for those properties, short of using a .NET reflection tool against the compiled assemblies.

Upvotes: 5

Related Questions