asp.net-mvc-3

Migrating my MVC 3 application to MVC 4

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-20 14:23:33
问题 I really do not know what to do, I'm following this article that shows how to migrate my MVC 3 application manually . I followed all the steps but when running my application the following error occurs: Server Error in '/' Application. Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT:

Ajax.ActionLink(…) with checkbox

丶灬走出姿态 提交于 2020-01-20 07:07:25
问题 Ajax.ActionLink("Link name",....) it is possible to put checkbox in place of "Link name" ? if so how? thanks, 回答1: Yes, of course that it is possible. You could use a standard checkbox: @Html.CheckBoxFor( x => x.Foo, new { data_url = Url.Action("SomeAction", "SomeController"), id = "mycheckbox" } ) and then in your separate javascript file use jQuery to subscribe to the change event of this checkbox and unobtrusively AJAXify it: $(function() { $('#mycheckbox').change(function() { var data = {

Ajax.ActionLink(…) with checkbox

*爱你&永不变心* 提交于 2020-01-20 07:07:09
问题 Ajax.ActionLink("Link name",....) it is possible to put checkbox in place of "Link name" ? if so how? thanks, 回答1: Yes, of course that it is possible. You could use a standard checkbox: @Html.CheckBoxFor( x => x.Foo, new { data_url = Url.Action("SomeAction", "SomeController"), id = "mycheckbox" } ) and then in your separate javascript file use jQuery to subscribe to the change event of this checkbox and unobtrusively AJAXify it: $(function() { $('#mycheckbox').change(function() { var data = {

Ajax.ActionLink(…) with checkbox

匆匆过客 提交于 2020-01-20 07:05:05
问题 Ajax.ActionLink("Link name",....) it is possible to put checkbox in place of "Link name" ? if so how? thanks, 回答1: Yes, of course that it is possible. You could use a standard checkbox: @Html.CheckBoxFor( x => x.Foo, new { data_url = Url.Action("SomeAction", "SomeController"), id = "mycheckbox" } ) and then in your separate javascript file use jQuery to subscribe to the change event of this checkbox and unobtrusively AJAXify it: $(function() { $('#mycheckbox').change(function() { var data = {

Debug a script that sits in a partial view

送分小仙女□ 提交于 2020-01-20 02:36:08
问题 Why I can't debug scripts that reside in a partial view, that gets created in runtime? To see the script in the list of scripts (in Chrome for example) and debug it, I have to move it to the "regular" view on the upper level or I have to move it to a separate .js file. But what, if the script so small that I don't want to move it anywhere, and still want to be able to debug it? 回答1: If you do not load the partial view via ajax (the view is in place at the initial page rendering) you can use

Passing Data to a Layout Page

梦想与她 提交于 2020-01-19 12:47:04
问题 I have a layout page that has variables that need to be filled. Example: @ModelType KarateAqua.schoolModel <html> <body> @RenderBody() <div id="footer"> <div class="content"> <div class="bottom_logo"> <a href="/"><span class="inv">@Model.schoolName</span></a> </div> </div> </div> </body> </html> I don't want to populate this in every ActionResult . Is there a way to pass data to a layout page once and do it for all instances? 回答1: OK since you want this to be set once you can make use of a

Passing Data to a Layout Page

血红的双手。 提交于 2020-01-19 12:46:13
问题 I have a layout page that has variables that need to be filled. Example: @ModelType KarateAqua.schoolModel <html> <body> @RenderBody() <div id="footer"> <div class="content"> <div class="bottom_logo"> <a href="/"><span class="inv">@Model.schoolName</span></a> </div> </div> </div> </body> </html> I don't want to populate this in every ActionResult . Is there a way to pass data to a layout page once and do it for all instances? 回答1: OK since you want this to be set once you can make use of a

Passing Data to a Layout Page

允我心安 提交于 2020-01-19 12:45:10
问题 I have a layout page that has variables that need to be filled. Example: @ModelType KarateAqua.schoolModel <html> <body> @RenderBody() <div id="footer"> <div class="content"> <div class="bottom_logo"> <a href="/"><span class="inv">@Model.schoolName</span></a> </div> </div> </div> </body> </html> I don't want to populate this in every ActionResult . Is there a way to pass data to a layout page once and do it for all instances? 回答1: OK since you want this to be set once you can make use of a

Running an ASP.NET MVC app from a virtual directory in IIS7

你说的曾经没有我的故事 提交于 2020-01-19 10:07:55
问题 Is it possible to run an MVC application from a virtual directory in IIS7? I have built an open source utility app in ASP.NET MVC3 and wondering if that was a mistake; it likely is if the site cannot be run from a virtual directory. Take a simple default route of /home/index if running from a virtual directory named /app , will actually be /app/home index. Which kind of messes things up for routing. I don't want a user to have to change routes and recompile the project to use the app in a

Ajax.BeginForm that can redirect to a new page

元气小坏坏 提交于 2020-01-19 05:22:07
问题 I have an @Ajax.BeginForm for my model which has a boolean value ( @Html.CheckBoxFor ). If this is checked, I want my HttpPost action to redirect to a new page. Otherwise I want it to just continue being an @Ajax.BeginForm and update part of the page. Here is my HttpPost action (Note: Checkout is the boolean value in my model) Controller: [HttpPost] public ActionResult UpdateModel(BasketModel model) { if (model.Checkout) { // I want it to redirect to a new page return RedirectToAction(