How to find the declaration of a view/action in ASP.NET - asp.net

I'm new to ASP.NET.
I have a web project in which every View or Action name are underline as you can see in the image (Sorry but it takes at least 10 reputations to post image).
Image
It contains 2 declarations, the first one is the default: ViewResult Controller.View().. like normal. And the second one is the View file or the action that it refers to.
When you use Go to Declaration command, it'll bring you to that file or that action. That's what I want, but I don't know how to get it. I have Resharper installed and using Visual studio 2013. I have tried to create new project but it just show only the default declaration. I get this project from a private source and the one who give me have no idea about it.
Please help me if you know. Thank you very much.

If you are using Resharper then just Right click On underlined text and select Go to Declaration or Go to Implementation. It will take to you view file.
I hope it helps you.

I don't know why but changing the default library System.Web.MVC from version 5.1.0.0 to version 4.0.0.0 have enabled that feature for me. But it'll need to change other references to downgrade the whole project to version 4.

Related

How can I make a Visual Studio 2017 custom editor refresh the text view?

I have created a Visual Studio custom editor extension (implementing ITagger<T>). It works perfectly and applies syntax highlighting according to the domain specific language behind it. Nonetheless, when I edit the text, VS re-tags and re-formats only the edited line.
However, when a particular line changes, I need to force re-formatting all the visible lines following the edited line. I do not know how to do this. I tried many alternatives, including responding the Changed event of the TextBuffer behind.
Can you help me with ideas, or sample source code to custom editor implementations that handle this issue? The built-in C# editor does it: when I edit a line, and it becomes a multi-line comment, the text view is changed accordingly.
The extension code Formatter could format the class file and arrange fields, properties and methods as per StyleCop rules. Maybe it is an extension you want to get:
https://marketplace.visualstudio.com/items?itemName=vs-publisher-599079.CodeFormatter
One crude way is to close the document and open it again.
string path = dte.ActiveDocument.FullName;
dte.ActiveDocument.Save();
dte.ActiveDocument.Close();
dte.ItemOperations.OpenFile(path);
Although, I hope there is a better way to deal with this issue.
Edit: Well, I think I found a better way.
An event is declared in your tagger class (which implements ITagger interface). Raising the interface does the job flawlessly.

TornadoFX: Label text not updating

One of the issues I'm currently experiencing is that I can't seem to change the text of a Label which is implemented in a dynamically loaded AnchorPane. I assume this might be related to the controller and how JavaFX/TornadoFX works, but I can't seem to find what I'm doing wrong.
The issue itself occurs in this class, and happens in the showSystemDetails() method. What I would expect to happen is that upon pressing the "System Details" button in the sidebar, the labels would update to the required value, but this isn't happening for some reason.
Please feel free to point me to what I'm doing wrong, or provide any constructive criticism. The project is still in full development so a lot of things are still messy/broken.
The reason this isn't working is that you're manually loading a new version of the FMXL file every time you select something in your menu. The FXML file originally loaded by SystemDetailsViewProxy is updated correctly, but that's not the one you're showing on screen anymore.
To see the updated View, make sure you put the root node of the SystemDetailsViewProxy instance back.
You could for example change your DrawerMenuButton enum to contain references to SystemDetailsViewProxy::class instead of those two strings, and use add(viewClass) to add the correct root node to your view when clicking the menu buttons.
Furthermore, you should be using ViewModels and binding instead of manually updating the text property of the labels. You're doing an awful lot of manual/error prone work that the framework can help you with for free.
Your application is not using best practices in several important areas, and you're rolling your own solutions for stuff that the framework already does very well :)
Views are singletons when managed by the framework, but you instantiate them yourself instead of using inject/find. The result is that important life cycle methods are not being called.
I would also suggest looking into type safe builders instead of FXML.
Hope this helps :)

WebForm project to MVC - missing context menu items

I have a significant webform project that needs MVC4 integrated into it. MVC controllers etc.. are working fine. However i am not getting the MVC type context menu items e.g. add view when right click a controller method (see below - this is the add view that I want to see. It is missing from my project).
I have tried creating a blank MVC project then swapping out the web form csproj file for this and readding in all the webform elements but it broke the site in all manner of ways that i don't have time to resolve. I really don't want to go down this rabbit hole in any case - i suspect it's the wrong approach.
I have tried adding in (what i believe to be) the correct projecttype guid into the csprojj file by editing with a text editor i.e.
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};
{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
becomes
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};
{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
but i still do not get the correct context menu items.
Can anyone tell me what I am missing?
Many Thanks for all help
Edit
This link gives an example for MVC3 and gives an idea of what I am trying to achieve. But the project type guid crashes the site (because it is MVC3) and my own efforts aren't working
http://www.britishdeveloper.co.uk/2011/05/convert-web-forms-mvc3-how-to.html
Further details i think are probably irrelevant
The project is an install of EPiServer Relate+ 7. A new site is starting from this but the majority of the site itself will be MVC (i hope). But we will use the re-existing web form elements for community type pages. There is no time or budget to convert these.
I don't think this is relevant to the solution. I think the problem is generic rather than particular to EPiServer.
Embarrassing!!!
I nearly got this right. I just needed to restart Visual Studio when I changed the project type Guid
So - the project type Guid for MVC4 is
{E3E379DF-F4C6-4180-9B81-6769533ABE47};
and the full element is
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};
{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
BUT - don't forget to restart Visual Studio (Doh!!!)
I'll keep this question up in case others have got the same problem
Thanks for everyone's time

Models are missing in strongly typed view drop-down

First of all, I apologize if this question is unclear, I am going to try and be as clear as possible.
My solution has 2 projects: Models and View/Controller. The View/Controller project knows what is in the Models project but not vice-versa.
I have created some Text Templates to automatically create CRUD Pages that work when I use the Add View dialog box to add new Views. This obviously happens in the View/Controller project. I've been using this without issues for a long time.
I am able to run the project without syntax errors or runtime errors, but when I use the Add View Dialog Box to try and create a new page, I choose the strongly typed option and I do not see anything from the Models project.
Things I have tried:
Reattaching the DLL for the Models as a reference to the View/Controller project again.
Build and Rebuild as well as Cleans
Manually typing everything in the dialog box (fails).
I do not want to create this page manually, as it will make errors/bugs very likely whereas the Template will reduce the amount of bugs I am likely to encounter.
Don't know how it did it, but I cleaned the project again (after failed attempts) and it finally works.
Before Adding View just Build the solution and then add view it will work. if it will not work then you can again concern with me i will give you another solution

How do I display content assist in flex builder for all classes?

I have a components and classes project library. Within the library, flex builder only seems to display content/code assist options for top level classes (e.g. arguments, Array) but not other classes such as VBox. Also, within the non top level classes, class properties are not provided by content assist.
In my other flex projects in the workspace, content assist works fine.
Any help would be greatly appreciated!
Flex / Flash Builder is often inconsistent in stuff like this; but I have never seen the exact situation you describe.
Have you tried closing down and relaunching Flex Builder?
Have you tried launching Flex Builder with the '-clean' attribute?
Have you tried cleaning your workspace?
Are you sure you do not have a syntax error somewhere causing issues? Are all the classes in the library included in your library class? Sometimes error don't show up if the class is not used, and therefore not compiled into the file SWC.
Did you save your source files? I don't think Eclipse updates its index until you save - so, if you just wrote class X with function Y, but didn't save X.as, then Eclipse won't know what to do with X.Y(...
Sometimes when I've run into the problem you're describing, it's been because FB wasn't able to determine what type of object I was using (for example, obj["toto"] = ?).
Another idea may be to update your version of eclipse ("Software Updates" or something like that under the Help menu).
Finally, there's an annoying issue that happens to me sometimes where the content assist will appear for about half a second, then disappear like the window tried to scroll and lost the pop-up. Do you get anything when you press Ctrl-Space?

Resources