razor

I'm upgraded my project to Razor view engine, but VS2010 still auto-generates WebForms

妖精的绣舞 提交于 2019-12-20 06:15:36
问题 I have upgraded to MVC3 and Razor, everything works fine. However, in my return View(model); the "View" is red and VS2010 will helpfully suggest I generate a view. When I do, it generates a aspx/WebForms view. There's no other aspx files in the project, and if I run the project, the Razor view engine works fine. There's obviously a setting somewhere that tells VS2010 which to default to, I can't find it. Any suggestions? 回答1: These are not explicit answer but rather a list of actions that you

How to pass values from view to controller in ASP.NET MVC 3 (Razor)?

亡梦爱人 提交于 2019-12-20 05:52:10
问题 I have this table in database: http://i.stack.imgur.com/C7CWX.png And I display all value in 'music' without repitions by this code(View): @foreach (var item in Model.Select(m => m.music).Distinct()) { <tr> <td> @Html.ActionLink(item, "Deep", ViewData["item"]) </td> </tr> } Result: Jazz Disko Rock Metal And I want when I pressed 'Jazz' result was 'Miles','Kirk' etc. How do it? I think I may pass value from View to Controller, but i dont know how do it in my situation. Please help me Action in

how to load selected partialview in a view in asp mvc?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 05:49:16
问题 I am working on ASP.NET Mvc project. i have a view similar to image: enter image description here I design right panel in layout. my layout code: <div class="col-md-3 panel panel-info" style="margin-top:20px;"> <div class="panel panel-primary" style="margin-top:8px;"> <div class="panel-heading">Setting</div> <div class="panel-body"> <div class="list-group"> <a href="#" class="list-group-item active text-center">Lists</a> <hr /> <a href="#" class="list-group-item">Add Users - Partialview 1</a>

Running a copy of a .cshtml file gives a 404

余生长醉 提交于 2019-12-20 05:38:51
问题 I've created a copy(right-click Copy & Paste) of my Home page in a VS2013 ASP.NET MVC5 project and named it indexL10. When I try to run it, I get the following error: Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Home/IndexL10 So, I'm guessing there's more to it than copying and pasting.

Error when trying to Scaffold a model

醉酒当歌 提交于 2019-12-20 05:17:10
问题 I'm building a Razor Page app using ASP.NET 2017. When I run the command dotnet aspnet-codegenerator razorpage -m Activity -dc CongContext -udl -outDir Page\Activities --referenceScriptLibraries This error appears: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) I stopped and restarted VS, I

Child actions are not allowed to perform redirect actions. (Using PartialViews)

耗尽温柔 提交于 2019-12-20 04:57:11
问题 I'm trying to load my partial view with some data from database, but I'm getting following issue when I run the application: Child actions are not allowed to perform redirect actions. I don't know why this is happening because I'm pretty new with MVC technology. Here is my PartialViewResult method in a controller: public PartialViewResult UnReadEmails() { if (User.Id != null) { List<Emails> resultList = EmailController.GetUnreadEmailsByUserId(User.Id); return PartialView("~/Views/Emails/

How to call a razor page from a Blazor component in a Server Side Blazor Application without causing a page refresh

南笙酒味 提交于 2019-12-20 04:56:09
问题 I am developing a Blazor Server Side Application which I need to include cookie authentication. We created a custom login page component, but in order to create a cookie I need to call a Razor page to create the cookie. Is there a way to call the razor page without doing a page refresh. I tried using the UriHelper.NavigateTo but does not work with non Blazor component routes. Then I tried with a Javascript call to do a window.location, but the issue is that this causes a browser refresh that

How to call a razor page from a Blazor component in a Server Side Blazor Application without causing a page refresh

佐手、 提交于 2019-12-20 04:56:06
问题 I am developing a Blazor Server Side Application which I need to include cookie authentication. We created a custom login page component, but in order to create a cookie I need to call a Razor page to create the cookie. Is there a way to call the razor page without doing a page refresh. I tried using the UriHelper.NavigateTo but does not work with non Blazor component routes. Then I tried with a Javascript call to do a window.location, but the issue is that this causes a browser refresh that

Setting ASP.NET Core TagHelper Attribute Without Encoding

こ雲淡風輕ζ 提交于 2019-12-20 04:53:55
问题 I want to add the integrity attribute to a script tag in my tag helper. It contains a + sign which I don't want encoded. <script integrity="sha384-Li9vy3DqF8tnTXuiaAJuML3ky+er10rcgNR/VqsVpcw+ThHmYcwiB1pbOxEbzJr7"></script> This is my tag helper: [HtmlTargetElement(Attributes = "script")] public class MyTagHelper : TagHelper { public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { // Omitted... output.Attributes["integrity"] = "sha384

multiple files upload using single file tag

馋奶兔 提交于 2019-12-20 04:13:29
问题 I Have seen many posts about everyone is using this approach <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="files" id="file1" /> <input type="file" name="files" id="file2" /> <input type="submit" /> </form> And then in controller the use [HttpPost] public ActionResult Upload(IEnumerable<HttpPostedFileBase> files) { foreach(var file in files) { file.SaveAs("myPath"); } return RedirectToAction("Index"); } I tried and succeeded this way. But when I do it