can't create a razor page in asp.net - asp.net

I'm trying to create new pages for my app in ASP.NET razor pages, but I can't see anything
trying to open it
I'm right clicking on the folder then clicking add,
then I'm clicking Razor Page and getting to this page
then I click add and get to this page
and here is where I'm getting stuck, because in that page there is no option to use Razor Pages.
is there any thing I'm doing wrong?
thank you.

When I choose Add=>Razor Page,I will get:
And when I choose Add=>New Item,I will get:
Maybe you can try to choose Add=>New Scaffolded Item,then select Razor Page in the menu:

Related

What the difference between a razor content page and a regular content page in ASP.Net

I'm new to ASP.NET so sorry if this is an obvious question. I did google it but I'm still confused.
So I created a master page in my ASP.Net project and I went to the website button at the top of visual studio to bring down the drop-down menu and clicked "add new item".
I went to add a content page and the only content page that shows up is "content page(razor)". This adds a page with a ".vbhtml" file extension. I'm trying to add a ".aspx" file with an attached vb page but it does not appear in the list.
If I right click the master page it gives me the option to add this type of content page but auto names it "default". so here's my question.
Is there a way to add the regular content page while having the ability to name it before it is created?
What's the difference between a razor content page and an asp content page?
ASP.NET
can be Webform
event driven coded
client side is aspx
contains asp:controls, html...
MVC (MVC 3, 4, 5, 6)
MODEL - VIEW - CONTROLLER coded
client side is cshtml or vbhtml
contains razor, html...
If you want to create an ASP.NET webform, do not choose MVC, your project won't look the same and is not coded the same way.

Render An aspx File (Menu Bar) in Razor View Layout Page

I have been looking around looking for a solution for this issue but have yet to arrive to a solution that works. I was using this as a reference but couldn't get anything to work:What is the right way to '#include file' in MVC?
I have an MVC 4 project that uses a Razor for the views and I want to add an aspx page that contains a menu bar that I would to add to the _LayoutPage.cshtml. As of right now I have recreated the menu so it looks the same in my razor view but the issue is that when a change needs to be made to the menu.aspx page I have to make the same changes in my razor view.
So my goal is to just render this menu in my layout.cshtml page.
This is what i have right now but it does not work. Is there anyway to do this?
<div id="page-header">
#Html.RenderPartial("P:/menu/menu.aspx")
</div>
Place your .aspx file in Views foulder and then:
#Html.Partial("~/Views/WebForms/menu/menu.aspx")
Also, could be that it is not working becouse RenderPartial works other way, try:
#{ Html.RenderPartial("P:/menu/menu.aspx"); }

Drupal webform form action

I'm adding a form to a Drupal website. I've created a new page, and created a webform, the webform has been assigned to the page content as a block.
The problem I'm having is when submitting the form, instead of showing the errors of the form at the top of the page like the rest of the forms do, the form action is set to the individual web form page, and any styling/content blocks disappear.
Essentially what I need to do is ensure the form posts to the same page, if I edit the form action in dev tools, the errors show fine at the top of the page.
EDIT: Should also add - I've setup the page and wbeform as per all the others, and they all function as they should and post to the same URL as the page.
Any help appreciated.
Thanks
If you are using the Webform module then you can go to the configuration page of the block in the 'Blocks' section, and look for the following checkbox:
Show all webform pages in block
The description under the checkbox tells you that anything that has to do with the webform (includes errors) will be shown on the current page, instead of redirecting you to the original webform page:
By default multi-page webforms redirect to the node page for all pages after the first one. If checked, all pages will be shown in the block instead.

drupal Webform Issue

I have created a tpl file for render the webform node.webform is working fine but after submit it returns to same page rather than goto thanks page. i want to redirect the action to thanks page.
You can actually create your own page that you want your users to be directed to after submitting a webform, and provide whatever links you like on this page. To do this, edit the webform and go to Form Settings. Under Submission Settings, click Customize Confirmation and choose "Redirect to a different page" from the jump menu. Under path, provide the path to this page that you've created.

Error appeared when I changed default page in visual studio

First, I did not like the index.cshtml page is that it contains the signature of Web API ASP.net, the API link, ...so on. And it also it contains the footer as '2015 # My Asp.net Application'.
So, is there a way that I can get rid of the header and signature? I found the solution as that could be at the master page, but I couldn't find the master page with extension (.master) in my application.
Please help me in getting rid of the header and signature of Asp.net Web API.
Second, I set another page as 'Set page as Start page' or as default page. Then when I changed my mind and came back and made the index.cshtml page as default page as it was, I got Server Error (page not found).
Please help me in either one way where I can create a new html page to add my code in it, and I can make it as start page without problems.
Or at least, let me fix the error that occurred in the index.cshtml page, where I can come back to it and use it again.
Thank you
In MVC razor the master page is referred to as the _Layout.cshtml page it can be found inside Views->Shared.
To set the default page you would have to set the default action and controller in the routing table
Footer
Ctrl+Shift+F Search Entire Solution for: "My Asp.net Application". This displays _Layout.cshtml as a search result.
Default Page
Go To Project > Properties > Web.
Remove Start Action Specific Page (make it blank).

Resources