asp.net-mvc-2

Hosting a Silverlight application in a View?

六眼飞鱼酱① 提交于 2019-12-11 16:55:19
问题 I need to write a little wizard application into which a user inputs some information. I was going to write this as a silverlight application. The website hosting it is developed using ASP.NET MVC 2 (.NET 4.0). Is it possible to host a silverlight application in an ASP.NET MVC 2 View? Also, are there any good frameworks out there for creating online wizard applications like the one I need to create? TIA 回答1: Is it possible to host a silverlight application in an ASP.NET MVC 2 View? Yes,

ASP.NET MVC Area not picking up the correct route

落爺英雄遲暮 提交于 2019-12-11 16:45:08
问题 I am in the process of debugging a routing issue on my MVC 3 application and I am using Phil Hacks routing debugger. I cannot seem to work out where the route highlighted in yellow below is originating. Each time I run my application with the following request http://www.mywebsite.com/auth/login?ReturnUrl=/ this route comes first and then gives me a 404 error as I do not have an index action. As you can see I have set my default routes to use the Login action method but still this route

MVC 2.0 Routes, redirect request, ignore request

纵然是瞬间 提交于 2019-12-11 16:35:09
问题 IIS 7.5 MVC 2.0 ASP.NET 4.0 If my MVC site getting external request for any not existed files, e.g SomePage.aspx is there any ways to redirect such request to any controller/action. I am using elmah and it is throwing errors when such kind of requests coming. Also i did add routes.IgnoreRoute("SomePage.aspx") in global.asax.cs to ignore this requests the same as i add to ignore favicon.ico but for SomaPage.aspx it is won't work, elmah throwing errors anyway. So there is three questions

ASP MVC 2 Dynamic Href By Javascript

佐手、 提交于 2019-12-11 16:17:37
问题 Here is the deal: My link: <li><% =Html.ActionLink("Scheme", null, null, null, new { @id = "schemeid" })%></li> JavaScript for changing href: <script> document.getElementById('schemeid').href= "Test/ALL"; </script> Its working in any browser on ASP.NET dev.server on vs2010; but when i host it on iis 7. it fails. and in source of web page i have href="" can any one help? 回答1: First of all, try using Firefox and check "Console Errors" to see if you got any javascript error. Second, try this:

ASP.NET MVC2 - hook into client side validation

人走茶凉 提交于 2019-12-11 16:05:44
问题 I want to trigger some custom code when the client side errors are updated using ASP.NET MVC2 client side validation. I've tracked down this function which I want to hook into: Sys.Mvc.FormContext.prototype = { // ... _displayError: function Sys_Mvc_FormContext$_displayError() { if (this._validationSummaryElement) { if (this._validationSummaryULElement) { Sys.Mvc._validationUtil.removeAllChildren(this._validationSummaryULElement); for (var i = 0; i < this._errors.length; i++) { var liElement

Highlight of active view in MVC2?

风格不统一 提交于 2019-12-11 16:05:28
问题 Okay, my site is www.kristianbak.com. I have a css class called activebutton . I want that to change whenever another View is active. Currently it's merely hard-coded in the HTML (sitemaster). Anyone with a good idea? 回答1: You could test the current action and if it matches apply a CSS class: <% if (ViewContext.RouteData.GetRequiredString("action") == "About") { %> ... highlight here <% } %> Even better I would write a HTML helper to generate the menu: public static MvcHtmlString MenuItem(

Best way to display a group/selection of radiobuttons from the choice of a single radiobutton?

流过昼夜 提交于 2019-12-11 16:01:55
问题 I have a form which for some questions would ask if something was included and if it isn't to supply a reason. So I need a radio button which records to the database it's value like normal which I have setup with a RadioButtonFor and if "No"(false) is selected then a group/list of other radiobuttons will display. Ofc this is just the ideal solution if this method isn't feasible then another solution would be to maybe a if statement in the controller so that if that main radiobutton has a

What is this error “A fatal error has occurred HRESULT=0x8007000e. Error Code=0x0” in VS 2008

故事扮演 提交于 2019-12-11 16:00:09
问题 While i am trying to run a MVC 2 application in VS 2008 i am getting following error: A fatal error has occurred HRESULT=0x8007000e. Error Code=0x0 can any one explain what is the problem? 回答1: An HRESULT has three parts: some flags, a "facility" and the error code. 0x8007000e 8: Error 7: FACILITY_WIN32 : ie. this is a Windows error. E: or 14: ERROR_OUTOFMEMORY So you process or system is overloaded. 回答2: Possible duplicate: Why am I often getting error 0x8007000e when debugging a project in

How to tell IE to ignore previously received malformed HTML and render different HTML?

女生的网名这么多〃 提交于 2019-12-11 15:59:57
问题 We have an MVC.Net 2 application running with .Net 4.0. There are cases where embedded code in our views may err, sending malformed HTML to the browser. How can I tell Internet Explorer to close any open attributes and elements so it can properly render an error message? To catch and log errors in the embedded code, I'm enclosing the view's HTML and embedded code in the try block of a try-catch structure and just want a simple message displayed to the user after logging the error. Example: <%

ASP.NET MVC Intentional Ajax Failure

梦想的初衷 提交于 2019-12-11 15:48:20
问题 I am making an ajax call to my controller which is going to perform a long operation. The operation can fail for many reasons or succeed. If I want to force the failure code of my ajax call to execute ("error"), what do I need to do in my controller before returning? Just throw an exception? 回答1: Throwing an exception will lead to status code = 500 which will invoke the error handler, so it should be enough. 来源: https://stackoverflow.com/questions/4002795/asp-net-mvc-intentional-ajax-failure