asp.net-mvc-2

ASP.NET MVC 2 Model Validation (DataAnnotations) on Subobject

Does the ASP.NET MVC 2 model validation includes subobjects? I have an instance "Filter", from this class: public class Filter { [StringLength(5)] String Text { get; set; } } in my main object: public class MainObject { public Filter filter; } However, when I do TryValidateModel(mainObject) the validation still works o...

$.getJSON inside client side custom validation

hey guys I got ASP.NET MVC 2 running and I'd like to check for the existence of a client (basically a front-end user) via validation. To do that server side is obviously pretty easy, but I have some trouble getting it to work client side, since I somehow have to wait for the callback function inside the function which gets returned by t...

ASP.NET MVC 2 Embedded Database

Hi, I am building a very small temprorary website that needs a small backing store. I have built this in ASP.NET MVC 2, and wanted to host with DiscountASP - although this isn't essential. I would like an backing store that will work with ASP.NET MVC 2, VS2010 Express, enabled LINQ (or EF) and work without further charges on a shared h...

In ASP.NET MVC 2, how do I get Html.TextBoxFor to render a textarea instead of an input tag?

This code: <%: Html.TextBoxFor(model => model.DonationMessage) %> Renders an input type=text tag, but I want a textarea. I tried this in my entity but it didn't make a difference: [DataType(DataType.MultilineText)] public string DonationMessage { get; set; } Any idea? ...

SSL port 443 conflict, how to make iis7.5 not think another process is running?

I am running a asp.net mvc2 application on iis7.5 using a SSL certificate for port 443. but as soon as I add port 443 to the Bindings (on "Site Bindings") it wont browse to the site through the HTTPS scheme complainng of another process working. I have tried renaming port 80 to 8080 to no avail. Hope someone can help. All the best P...

ASP.net MVC 2: Scaffolding & Hiding Table Columns in the View

The partial class: using System.ComponentModel.DataAnnotations; namespace CSR.Models { [MetadataType(typeof(SO_Validation))] public partial class SO { //__ } public class SO_Validation { [ScaffoldColumn(false)] public Int16 soID { get; set; } [Display(Name = "Full Name")] ...

Asp.net mvc application authentication lost every 20-50 seconds

hi, My asp.net mvc application, requires me to login every 20-50 seconds, i contacted the hosting provider, who says its due to recycle of pool. i have added following code to web.config. <sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" cookieless="false" timeout="20"/> the problem is not solved, how do...

Proper way of building MVC ActionLink

I've got an MVC ActionLink like so (which works just fine) <%: Html.ActionLink(user.UserName, "Details", "Users", New With{.id = user.ID, .slug = Replace(user.UserName," ","-")}, nothing)%> But since it's not "recommended" to do string manipulation in the View, I'm wondering how I could build a custom Html ActionLink to do the string ...

Why is ASP.NET SmtpClient.Send() making my site unavailable?

Hello everyone, I have an ASP MVC 2 application, through which I occasionally send emails using SmtpClient.Send(). Typically, emails are sent out in batches of between 1 and 50 emails, with hours or even days passing between batches. I have this all set up so that the emails are actually sending just fine. But, the problem is that when ...

Can't get sql server compact 3.5 / 4 to work with ASP .NET MVC 2....

I'm using Visual Studio 2008 Pro. I'm probably missing something very obvious here, but I've been trying to get the CTP for Sql Server compact 4 to work in my asp.net mvc application. I can find next to no instruction on how to set this up or a working example application. My goal is a private install so I can just include it in my web ...

Should i use ASP.NET MVC or ASP.NET 4.0 webforms

hello we are planning to start new asp.net web based application in few weeks. we have three members in our team all with experinced in asp.net 2.0 we are jumping direct from asp.net 2.0 to 4.0 (skiping 3.5) we were discussing should we go for asp.net 4.0 webforms or should we learn/develop in asp.net MVC. we dont have any MVC exper...

ASP.NET MVC 2 AJAX vs. jQuery

What better to use in ASP.NET MVC 2: - Ajax-forms created with the AjaxHelper class or - jQuery ajax? I think it's a little more straightforward to use the AjaxHelper, but I don't know if it's a good practice to have many forms on the page (AjaxHelper creates a form, whereas the jquery doesn't). ...

VS-2008 cannot find localhost, how can I get it to find it again?

I am using IIS 7.5 on Windows 7, Visual Studio 2008 and a MVC2 Web Application. I previously built the web application on the built in server then swapped over to IIS, all was good. I added SSL and port 443 into the bindings and since then have not been able to get VS to find localhost. When I try to create a virtual directory through...

MVC2 FormCollection options

I'm just getting started with MVC2 and going through the NerdDinner examples. I noticed that there seems to be multiple ways to pass in the form values for example: FormColelction formvalues FormCollection collection FormCollection form Why would you use one over the other and why? Does it also relate to whether you are using Entity ...

IIS and Entity Framework connectionstring seem duplicated but cannot see where

When I run my asp.net mvc2 web application using IIS7.5 and connecting up to SQL2008 I get the following messge: "The entry 'XXXEntities' has already been added.\Projects\ProjectName\web.config line 32" Now I think from what I previously read that IIS is reading it twice but can only find this string in the root web.config. Can anyon...

Why does this work?

I have something like this public class ViewModel { public List<Books> Test {get; set;} public SelectList List {get; set;} public ViewModel() { Test = new List<Books>(); } } public class Books { public string SelectedItemFromList {get; set;} public int forTextbox {get; set;} } view <% for (in...

ASP.NET MVC-2 Post to another website?

What is the best way to POST to another website (so that the users browser is redirected as well) in MVC2? I dont want the user to be able to see the form data simply by using "view source", so I'm not keen on <form action="http://other-site.com/action"&gt; <%= Html.TextBox("something-secret") %> </form> Is it instead possible (...

Return login view instead of redirecting in an MVC 2 application (site wide)

I have an MVC 2 application that every page requires authorization on (except currently for /Account/Logon), but I would prefer that instead of it forwarding to "/Account/LogOn?ReturnUrl=/SomePage" to authenticate the user, that it would just show the login form instead on the page the user requested so the URL doesn't change I already ...

Complex Binding not working with my dropdownlist?

Hi I have something like this public class ViewModel { public List<Books> Test {get; set;} public SelectList List {get; set;} public ViewModel() { Test = new List<Books>(); } } public class Books { public string SelectedByUser {get; set;} } <% for (int i = 0; i < 1; i++) { %> <...

Question about ASP.NET MVC 2 Custom ViewModels

In my project I have my Linq To SQL dbml file, A Repository Layer for each DB Table and a Service Layer for each Repository. In my service I have some MetaData for Validation as well as I extend each (table) Class to add some custom information to the object (you'll see this in the code below). My question is, Should I consider buildin...