asp.net-mvc

How to build a tabbed Edit View for a big ViewModel in ASP.NET without JavaScript?

I've got a big ViewModel for a ContactViewModel with several addresses (default, invoice, delivery). This ContactViewModel I would like to edit within a DefaultAddress tab, etc. and I would like to know how to handle this without JavaScript? Is this possible? ...

ASP.NET MVC: calling a controller method from view

I'm implementing paging on an ASP.NET MVC view, and I want to call a method in the controller from the view. Code in the view: <a href="<%= Url.Action("Search", new { page = NextPage(Request["exactPage"])).ToString()}) %>"> Controller method: public string NextPage(string currentPage) { return (int.Parse(currentPa...

Using a custom MvcHttpHandler v2.0 Breaking change from 1.0 to 2.0 ?

Hi I have a site where part is webforms (Umbraco CMS) and part is MVC This is the HttpHandler to deal with the MVC functionality: public class Mvc : MvcHttpHandler { protected override void ProcessRequest(HttpContext httpContext) { httpContext.Trace.Write("Mvc.ashx", "Begin ProcessRequest"); string originalPat...

ASP.NET MVC Html.RouteLink

I am trying to understand what this RouteLink does. Say, in my Global.asax, I have the default route for MVC routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home",...

How to create route

I want to use URL such as /Image/sample.png I create route, but it does not work, it say "The resource cannot be found" What is the problem? (action GetImage is in controller home) routes.MapRoute("Image", "Image/{id}", new { controller = "Home", action = "GetImage", id = "" }); ...

ValidateInputAttribute bug in VS 2010 RC / ASP.NET MVC 2.0?

Am I doing something wrong here? I have a text area on a view and am posting back the html contents. In VS 2008 and MVC 1.0 the following code successfully prevents input validation: [HttpPost] [ValidateInput(false)] public ActionResult Index(int? id) { return View(); } If I execute this code in VS 2010 / MVC 2.0 I always get thi...

Steps to Investigate Cause of Web.Config Duplicate Section

Symptoms In IIS 7 and Dot Net 2.0 Integrated app pool: double clicking to view any web.config section results in a the following error dialog. Browsing to the URL displays: "Http 500.19" internal server error.. There is a duplicate... 'system.web.extensions/scripting/scriptResourceHandler' section defined...." Running the ap...

Web request timeout in .NET

I am trying to make a web service request call to a third part web site who's server is a little unreliable. Is there a way I can set a timeout on a request to this site? Something like this pseudo code: try // for 1 minute { // Make web request here using (WebClient client new WebClient()) //...etc. } catch { } ...

error message: clientside validation

What is the meaning of the following error message?How can I use the EnableClienTValidation()? Error 3 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'EnableClientValidation' and no extension method 'EnableClientValidation' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a...

MetadataType and client validation in ASP.NET MVC 2

Inherited properties and MetadataType does not seem to work with client side validation in ASP.NET MVC 2. The validation of our MetadataTypes work as expected on the server but for some reason it does not generate the appropriate client scripts for it. Client side validation kicks in as expected for properties with the DataAnnotations a...

Custom form Authorization/Authentication linq to sql

All greetings Anyone can do their implementation Authorization system? Do not use the Membership API? Of course we could implement custom providers to plug a different database into this framework, as detailed at MSDN, but if my application is going to use a repository pattern for data access, and I’m going to have specific controllers ...

how to overload the += operator with the operands of different types (if possible)

Hi, Instead of having an add() method in the repository, I would like to overload the += operator so that the expression _repository += myModel; will insert myModel into the database(after i submit changes) I know that the objects of different type cannot be used in operator overloading. Still want to know if there is some alternate...

Accessing Linq Values in ViewData

I'm having trouble accessing the id, area and theme values in my ViewData. They are being set in my action filter but when I get to the Site.Master I don't have access to them. Any help or advice would be great. ActionFilter public override void OnActionExecuting(ActionExecutingContext filterContext) { int SectionID = Convert.ToI...

404 asp.net mvc - beginner question in routing

This is a beginner level question for asp.net MVC I have the following code in global.asax.cs public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route na...

How can I use a prefix for the fields in my strongly typed View?

Hi, I have an EditProfile action in my PersonController, that finds a Person object by ID and does return View(person). The EditProfile view has a bunch of fields that should be filled in with the information from the Person object. One of the fields is named "Person.FirstName", and is not filled in automatically when the View is rende...

What would cause all the images to your site not to show?

I've been working on a site for a client, and I'm taking a recently changed design and incorporating that design into the existing site. I was flipping back and forth between the two sites using firebug to compare the layout of the two. Everything was showing up fine, and I didn't have any problems. I stepped away from my computer for...

How to find out the current resource and controller name from the view in ASP.NET MVC

I'm using the ASP.NET MVC in a RESTful resource manner and I want to be able get the current resource and controller name from the view. I'm attempt to create a HTML page and I want to know the current resource and controller name is it possible to get this? ...

Difference between AppDomain.GetAssemblies and BuildManager.GetReferencedAssemblies

Just wanted to know if there is any difference between the two, in the context of a fully trust asp.net mvc 2 application. ...

ASP.NET MVC The new ActionLink with MvcHtmlString and request URL generated

This piece of code used to work in MVC 1 but it does not since I upgraded to MVC 2: <%=Html.ActionLink(Resources.Localize.Routes_WidgetsCreate, "Create" + "?modal=true", "Widget", null, new { rel = "shadowbox;hei...

Dynamic data validation in ASP.NET MVC

I've recently read about the model validation capabilities of ASP.NET MVC which are all very cool until a certain point. What happens if the application doesn't know the data that it works with because it is all stored in DB and built together at runtime. Just like in Drupal, I'd like to be able to define custom types at runtime, and ass...