Is there a Visual Studio "Go to Partial" shortcut - asp.net-mvc

I have an MVC project that uses a lot of Partial views, like in
#Html.Partial("_TasksGrid")
I happen to waste a lot of time looking for these partials and then finding that they are in the shared folder as opposed to the default folder and vice-versa.
My question is what would be the best way to navigate from one file to the other? Is there a shorcut/extension that can help me on this? I'd like to be able to put the cursor over the partial statement and press a shortcut that opens the partialview file.

In the end I got used to the "Edit.GoToAll" shortcut, but on my installation it had to be configured, I assigned Ctrl+T as my shortcut:
I can double click the partial name then hit Ctrl+T and the search will find the partial

Related

Where is the default 'Login' view and corresponding controller in the template MVC Core application in VS2019

Odd one this, I must be missing something obvious but with a brand new MVC web application, with Authentication, it builds the DB migrations for the asp user tables and puts the _LoginPartial in _Layout etc. and login works fine, I can login and register etc but I can't find the view or code to alter it.
I navigate to localhost:blah/Identity/Account/Login and can login, but there's no view in the project that corresponds, there's an /Areas/Identity folder but it only has /Pages under it, no /Account and there's no Login.cshtml or anything called Account anywhere in the project.
Very odd, I keep thinking I'm just being dim and will look again tomorrow but have done that a few times. I've tried searching for it but only find false matches.
I've created a brand new application from the template a few times now thinking I somehow messed up the choices in the dialogues but it seems so basic - the view is obviously somewhere as it loads up and works fine, but where's MVC getting it view from, and where is the controller it's calling ??
Similarly, I search the project for some text on the page, eg. 'Use a local account to log in', both in VS and using grep on the entire source folder but it's not anywhere.
To fill out the answer to the question behind my question - i.e. how can I customise the login page. To generate the views and code in-project, right click on the Areas/Identity folder in the project, select 'Add' and 'New Scaffolded item...', select Identity and go from there.
Trying that generated an error for me, with a Core 2.2 project; but I retried in a virgin Core 2.1 solution and it worked OK, I then transferred the added folders and files to my 2.2 solution, changed the namespaces to match and I can now alter the login form and log in with it OK.
The account management function to change the phone number also works, so seems like it's all hooked up OK, I've not tried any of the other identify functionality as yet.
Thanks again to Nkosi for the answer.

How to open a file from Grails app using <a> tag?

This is my first Grails project & I can't seem to do this very simple thing! I am trying to display a list of PDF forms in one page that I have saved under a folder called forms under my_project/grails-app/views/forms and want to open the PDF form in a new window when clicked.
In my .gsp file I am trying to access the forms like this:
Form #1
But that's giving me a 404 error.
I have found couple of solutions like this one or this question (which is very similar to mine)...but first of all, i don't need to upload/download the file. Second, i don't need to render the file either. All I want to do is just click the link and open the PDF file in a new window/tab. Am I saving the PDF files in a wrong place? Please help!! Thank you.
Place your file/directory into grails-app/assets so that you have grails-app/assets/forms/form_one.pdf then you can use the resource tag like this:
Form #1
The grails-app/views directory is used for views rendered by controllers, where as the grails-app/assets directory is used for static and pre-processed assets.

Need an Automatic Editor

what I'm looking for is some something similar to the automatically generated "delete" and "Create" functions that are created in MVC. I'd like one that is used to update a record. Preferably it would work much like a gridview (I'd prefer not to mix in ASPX pages), but if it creates a separate form, I'm okay with that too.
The best way to get started is to scaffold a controller. In Visual Studio right-click the Controller folder, Add > Controller, you'll have the option to scaffold a controller with Read/Write actions or using Entity Framework. In the latter case you'll need a create model to base it on before hand.
Once you've done this have a look for the Edit ActionResult, this allows you to edit single records. It's possible to do multiple records but it take a fair bit more work.

How can I find where actually is the theme file?

I am new to Symfony and I need to work to a large project with many themes to modify them. How can I find where actually is the theme file in which module, just looking at the HTML browser output? Or do I need to look somewhere else, routing for example?
What you want to do is use the Web Debug Toolbar.
Once you have that running on the page, using appname_dev.php, simple click the view link and it will show you which templates have been used. If you need to know which layout to use then use logs link, click none the sfPHPView.

ASP.NET MVC ContentPlaceHolders out of order?

I added a new ContentPlaceHolder (HeadContent) right below the Title so that I can add page-specific css and js files. But when I create a new View using the master page, it puts the default text of the page layout to have the HeadContent open/close tags at the end of the page. Unfortunately, I visually just see it as the first, second and third tags and start typing in my page's html into the last tag. But this isn't the BodyContent place holder because it is the second one. I have to go back and copy/paste them into the correct place. Ugh. Just for kicks, I scrambled all the tags around in the master page just to see what would happen in the view. Sure enough, VS.NET ignores their order in the master page and reorders them the same way everytime.
Why isn't VS just ordering the place holder tags in the same order as in my master page? Actually, how do I make it stop and just do it in the order I have in my master page?
What visual studio is doing (I assume) is loading the MVC View Content Template. I assume the reason all the contents are out of order from your master page is that Visual Studio Extensiblity loads the template then adds any ContentPlaceHolders that are not in the template after the template data.
You can see what the templates look like by going to your Visual Studio file in your Program files then goto Common7\IDE\ItemTemplates\CSharp\Web\MVC2.
There is also a folder for VB. In any case you can open the zip files located in that directory and drill down till you get to the .aspx page and you'll see what VS is inserting into your project when you do a Add New/View.

Resources