asp.net-mvc

ASP.NET MVC file encoding

Hi, I first worked on a page with an external editor (simply Notepad++). Since the content is Italian, I set the enconding to UTF-8 and all the symbols I needed just worked. The relevant parts are: <?xml version="1.0" encoding="UTF-8"?> [..] <html xmlns="http://www.w3.org/1999/xhtml" lang="it"> <meta http-equiv="Content-Type" conten...

Loading a Partial View in MVC ASP.Net using jQuery.

Hi I'm very new to both of these so please forgive my basic question. I have an index page like: <div id="SearchBar"> <%= Html.Encode("Search by Site Name: ") + Html.TextBox("SearchTextBox") %> <input type="submit" value="Search" id="jQuerySubmit" /> </div> <div id="SiteList"> <% Html.RenderPartial...

Putting a ASP.NET MVC web site in a subfolder

For a shared test environment I need to place an ASP.NET MVC 1.0 web application in a subfolder. So the URL to the web applications start page will look something like http://192.168.100.1/webapp1/. Is this possible at all or must it always reside in the root? ...

Forwarding http://mydomain.com/ctrlr/act/val to http://WWW.mydomain.com/ctrlr/act/val

I have an application written on ASP.NET MVC (V 1.0). The application runs on IIS7 and the DNS is provided by GoDaddy. I would like to forward any request that comes from http://mydomain.com/ctrlr/act/value to a URL of this form: http://WWW.mydomain.com/ctrlr/act/value Basically, I want to add WWW to the Host-name if someone tries to r...

Things that we hated about classic asp but still exist in webforms today

I'm working on a list of reasons for my team to move from webforms to MVC and I thought a good place to start was showing the "why we should migrate" with a set of things both classic asp and webforms have in common. Such as: Spagetti Code (violation of SRP) Classic ASP - each .asp file felt like a big ball of mud Webforms - this big b...

Making and receiving payments?

I am looking at building a Website that needs to receive payments from clients and make payments to service providers. Payments will most likely come in as Credit Card purchases and then monthly I will most likely have to pay the service providers after taking a fee. I know there are a lot of options for accepting money via a payment ...

MS-SQL Filling in Identity column values

I'm building an ASP.Net/MVC application using SQL 2008 Developer edition and a DB in Sql2005 compatibility mode. Using Entity Framework as DAL. My problem is that I have a table where I'm using the integer identity column in a like an Invoice Number, that is, it always has to be unique and never reused. So using the GUID column type w...

Form not submitting and no error is being produced with MVC

I have a form in my MVC application that in theory should submit data back to my database using a Repository class. However, when I submit the form (http://localhost:1028/Admin/NewUser/), the URL changes to where the form should be submitting to, which is fine (http://localhost:1028/Admin/NewUser/Submit), but once it has been submitted,...

model binding in mvc

i'm having a textbox inside a form. [View] <%=html.textbox("name") %> [Controller] Index(string name) { name = "something"; return View(); } On Form Submit In this case without sending any ViewData the textbox value is maintained.But the value "something" is not setting up. But whn i change the Action to [Cont...

Handling Json results in ASP.NET MVC with jQuery

I am working on a view containing two forms, handled by separate controller actions which return a string serilaized to Json: return Json(message); The forms are submitted using jQuery, by clicking on a button outside the two forms. The button handler: $('#inviteForm').ajaxSubmit({ success: function(html, status) { ...

SelectList Dropdowns in C# (Selected value)

Ok I have the following Code #region getDurationListDD private List<KeyValuePair<int, int>> getDurationListDD { get { List<KeyValuePair<int, int>> dDur = new List<KeyValuePair<int, int>>(); dDur.Add(new KeyValuePair<int, int>(2, 2)); dDur.Add(new KeyValuePair<int, int>(3, 3)...

Suitable CMS framework for MVC site

I have an MVC application in process of development and want to see if I can integrate it into an MVC-based CMS environment. The idea is that the application will appear to run in an environment wherein the user can actually add/edit web pages, download documents do blogs, handle Facebook integration etc. In some respects I am almost lo...

Extended HandleError Attribute - status code 112031 (connection reset)

I created a new class which inherits from the HandleErrorAttribute to handle ajax requests differently. The only override is on the OnException method: public override void OnException(ExceptionContext filterContext) { if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest()) { filterContext.ExceptionHandled = true...

Why does my VS2008 debugging session always quit on me when stepping through ASP.NET MVC controllers?

I'm running Visual Studio 2008 Professional SP1 on Windows 7 Ultimate x64 RTM. I'm using the ASP.NET MVC that you get from the Web Platform Installer. When I step through my program and pause on any line for longer than a few seconds the debugger suddenly stops and the following message is printed in the Debug Output: The program '[...

Invalid Cast when trying to loop over entities in EntityCollection in ASP.NET MVC

I'll just jump right into it. I have a model called "Request" which I created using LINQ to SQL. I have another model called "Comment". A "Request" can have many "Comments". In my controller I have this code: public ViewResult Details(int? id) { return View(requestService.GetRequest(id)); } In my view I have this m...

custom actionfilter sending formcollection problem

not sure if this is possible or if i am down the wrong road. i am wanting to use an attribute to clean out single quotes from my form posted data (this will be changed, but single quotes is a good example) i have created the actionFilter as below: public class RemoveSingleQuotesAttribute : ActionFilterAttribute { public NameValueC...

using Html.EditorFor with an IEnumerable<T>

I have a custom class: public class Person { public String Name { get; set; } public Int32 Age { get; set; } public List<String> FavoriteFoods { get; set; } public Person() { this.FavoriteFoods = new List<String>(); this.FavoriteFoods.Add("Jambalya"); } } I pass this class to my strongly typed ...

asp.net mvc Relational data not being passed to view

Hi everyone, I currently have a repository setup that loads forms a person would need to fill out when a view controller action is accessed... the way i have it setup is as follows: public ActionResult View(long id) { Patient patient = patientRepo.GetPatient(id); if (patient == null) return View("NotFoun...

Missing Classes and Methods in ASP.net MVC 2

I download asp.net mvc2 preview 2 days back. I've just started studying MVC. I tried to create a page to display Product details from AdventureWorksLT database. There is an Image in it (stored as byte[]). After googling for sometime I got some help and a few links from SO and other sites. There is one very nice post about doing this with...

Should I put validation logic in a POCO?

Let's say I have a POCO like so: public class Name { public string FirstName { get; set; } public string LastName { get; set; } } FirstName and LastName cannot be null. Should I add in a method like this: public List<Error> Validate() { var errors = new List<Error>(); if (String.IsNullOrEmpty(FirstName)) erro...