asp.net-mvc

Sample enterprise application for ASP.NET MVC?

I understand there are a number of small applications built on MVC. Is there an enterprise application sample that is standardized and uses best practices? ...

JIT compiler will come here again ?

Hi All , I have one doubt here , I have one asp.net MVC web application and every night we are recylcing the applciation pool from IIS. Now when the next day first request comes it is taking time to get response. First request it is taking time because app domain is not loaded (application is not started) to start web application it...

mvc create my own html helper, how can i access httpcontext?

Hi, I've come across two recommendations for creating custom html helpers: either extend an existing one, or write your own class. I'd prefer to keep my custom code separated, it seems a bit sloppy to extend helpers for a decent-size application. But the benefit I see in extending is that 'This HtmlHelper helper' is passed as a parame...

ASP.NET MVC 2.0 Copy ViewModel to Business Objects

I am using ASP.NET MVC 2.0 and I want to transfer my ViewModel properties to business object. I can do this manually or use AutoMapper or use new method available in ASP.NET MVC 2.0. My question is that does anyone know the name of the new method which allows to copy the properties from one object to another? ...

ASP MVC Populate drop down list on jQuery add table row

I have a page with several drop down lists that all have the same contents. The page starts out with only three ddls, but more need to be added based on user input. There is also other information associated with the drop down lists that is all in a table. So, when the user clicks a link I add a new row of textboxes and drop down lists t...

Navigating by foreign keys in ADO.NET Entity Framework/MySQL

I am using ASP.NET MVC2 on top of a MySQL database in VS2008. I am using the MySQL ADO.NET connector 6.2.3 to provide the connection for the ADO.NET Entity Data Model. This is mostly working ok, however navigating via foreign keys is causing me a real headache! Here is a simplified example.. Car (Table) CarID PK Colour Doors Manufactu...

UIHint argument in ASP.NET MVC 2.0?

Hi, I'm doing a custom template in my MVC app, something like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <input type="text" id="date" /> And in my POCO I refer to this ascx file like this. [UIHint("DatePicker")] public DateTime CreatedOn { get; set;} So I was wondering how can I send a para...

Telerik asp.net mvc datepicker "Invalid argument" in Internet Explorer (IE) 8

I am using Telerik asp.net mvc extensions. I have an issue that happens only in IE. I have IE 8. I don't have this issue in Firefox (3.6.3) or Chrome (4.1.249.1059) The problem happens when I want to pick a particular date by first clicking on the year on top and then the month. At that time, I get Invalid Argument error in jquery-1.4.2...

Render Html from a lambda in MVC

I have the following code to generate a list and will allow developers to customize the output if needed. <% Html.List<MyList>(item => item.Property).Value(item => return "<div>" + item.Property + "<br/>" + item.AnotherProperty + "</div>").Render() %> This is not ideal, how can I allow the developers to add the html similar to other c...

asp.net mvc session and custom MembershipProvider

Greetings, in my ASP.NET MVC application I've created a custom MembershipProvider. It works fine, however when user is successfully logged, I would like to create an Operator object and make it possible to access this object on every controller and view. I was thinking about session to do this but when session expires this object is nul...

Handling Exceptions that happen in a asp.net MVC Controller Constructor

What's the best way to handle exceptions that happen from within a controller's constructor? All I can think of to do is use Application_OnError() or put a try/catch in my ControllerFactory. Neither of these solutions seem ideal. Application_OnError is to broad - I have some non-mvc content in the site that has its own error handling. ...

Making an Ajax request to a page method in ASP.NET MVC 2

I'm trying to call a page method belonging to a MVC Controller from another site, by means of: $.ajax({ type: "GET", url: "http://localhost:54953/Home/ola", data: "", contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { con...

Asp.net mvc 2 .net 4.0 error when View model type is Tuple with more than 4 items

When I create strongly typed View in Asp.net mvc 2, .net 4.0 with model type Tuple I get error when Tuple have more than 4 items example 1: type of view is Tuple<string, string, string, string> (4-tuple) and everything works fine view: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/WebUI.Master" Inherits="System.Web....

if a controller action redirects to external url, what do you return in the function?

i have a function and i am unclear what i should return from this? public ActionResult LoadExternalURL() { Response.Redirect("http://www.google.com"); // what do i return here ?? } ...

how to test a twitter api on your local machine

i am using twitterizer to have a web front end to twitter data. I'm trying to figure out how i can test on a localmachine when you have to put in a valid public callback url in your application registration. The twitter page doesn't let you have a callback url like this: http://localhost:3444/Callback . . any suggestions? ...

How to handle payment types with varying properties in the most elegant way.

I'm using ASP.NET MVC 2. Keeping it simple, I have three payment types: credit card, e-check, or "bill me later". I want to: choose one payment type display some fields for one payment type in my view run some logic using those fields (specific to the type) display a confirmation view run some more logic using those fields (specifi...

jQuery post to another controller

If I have a Controller called "HomeController" and I'm on the Index page of that controller, how can I do a jQuery Ajax post to another controller. I tried the below, $.post("/DetailedQuote/jQueryGetDetailedQuote", { productCode: "LPJ" }, function(newHTML) { alert(88); }); I have a DetailedQuoteController. I have als...

Problem Paging with Post Action in ASP.NET MVC

I have a page that takes a number of parameters on a form and posts them to an action. It returns a number of search results that need to be paged through. My pager uses ActionLink; <%= Html.ActionLink(i.ToString(), "Basic", new { page = (i - 1) })%> The results comeback as expected but when I click on page two it goes to the default ...

JQuery delegate what may cause it to not function

I have a webpage using jquery 1.42 The following 2 segments of code live in my page. $('body').delegate('h2', 'click', function() { $(this).after("<p>delegate paragraph!<\/p>"); }); $('body h2').live('click', function() { $(this).after("<p>live paragraph!<\/p>"); }); The live method always works, yet the delegate doesn't fir...

jquery post and get request different on local intranet and live server

Hi, I have been developing an asp.net mvc application where i need to make large amounts of jquery post and get request to call controller methods and get back json result. Everything is working fine. The problem is i had to write different jquery post and get request url on local intranet(deployed by making virtual directory) and liv...