asp.net-mvc-2

Do you use <%: %> or <%= %> for html helpers in ASP.NET MVC 2.0?

I know they now have this in ASP.NET MVC 2.0 <%: Model.CustomerName %> So when you make HTML helpers is it better to use this way now (provided that you do not want to do HTML encoding)? ...

Too many JavaScript and CSS files on my ASP.NET MVC 2 Master Page?

I'm using an EditorTemplate DateTime.ascx in my ASP.NET MVC 2 project. <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime>" %> <%: Html.TextBox(String.Empty, Model.ToString("M/dd/yyyy h:mm tt")) %> <script type="text/javascript"> $(function () { $('#<%: ViewData.TemplateInfo.GetFullHtmlFieldId(String...

Deployment Error: Silverlight 4.0 w/WCF RIA Services in ASP.NET MVC 2 App

I've got an MVC 2 App with an RIA Services link to a Silverlight Application. The public facing portion of my site will be strictly MVC/HTML, but the administive portion will be silverlight (hosted in an MVC view page with data coming from RIA Services). On my development machine, all is well, but when I deploy to Discount ASP servers,...

The directory or file specified does not exist on the Web server.

I have a hybrid asp.net web forms / mvc application that I recently converted to .net 4 with mvc2. I have set-up that application to run on IIS 7.5 (on Windows 7) and the web forms part of the site is running okay but the MVC part is not. Whenever I try and access a page that needs to go through the routing engine I get HTTP Error 404.0...

Asp.NET MVC ActionFilter cannot get Form Submit data

I want to use custom action filter to manipulate parameters to one action. User inputs: 2 names in a form ; Action: actually needs to take 2 ids; Action Filter (onExecuting, will verify the input names and if valid, convert them into 2 ids and replace in the routedata) because i don't want to put validation logic in Action Controller...

Does a form gets closed after form.submit()?

I have the following code: $.ajax({ type: "POST", url: '<%=Url.Action("test","pepole") %>', data: $("#PeopleForm").submit(), contentType: "application/json; charset=utf-8", dataType: "html", sucess: function() { }, error: function(request, status, error) { $("#NotSe...

ASP.net MVC How to run multiple instances of the same app at the same time in different subdomains?

ASP.net MVC How to run multiple instances of the same app at the same time in different subdomains? I have a dozen or so subdomains. sub1.website.com sub2.website.com and the folder structure like this \website\sub1 \website\sub2 If i need to run the same app for all of the subdomains, what would be the best appoach? Host is in t...

asp.net mvc 2 validating text inputs on modal windows

hi guys, i am tasked with the job of creating client-side validation on a form in an asp.net MVC 2 application, which has a modal window (the modal exists as part of the wrapping form, it is not a form unto itself). how would i go about providing validation for these text field inputs while the modal is visible, but do not validate whil...

ASP.NET MVC 2 Dynamic QueryString Management

Hello All, I am very new to ASP.NET MVC and currently, I am involved in developing a new application in ASP.NET MVC 2. I am having problem in managing a long querystring parameters that comes from dBase. For example, in any non-mvc app the following URL works well: http ://example.com/test.aspx?first_name=fname&last_name=lname&email_i...

ASp.NEt MVC: how to parse url string to get RouteData

Hi. Is there any way hot to get RouteData from url string? I have login form with returlUrl as query string parameter. My routes are defined as : {languageCode}/{controller}/{action} In action method LogIn(string returlUrl) the returlUrl is something like "en/home/contacts" etc. I need to change languagePart a i dont want to use strin...

MVC2 Client-Side Validation for injected Ajax content

Hi, I am making an Ajax call and adding content to a form inside a MVC2 app. I need to update the Client Validation Metadata with the validation for my new content. <script type="text/javascript"> //<![CDATA[ if (!window.mvcClientValidationMetadata) { window.mvcClientValidationMetadata = []; } window.mvcClientValidationMetadata.push(...

ASP.NET Mvc 2 How do you launch client side validation from inside javascript?

Is there a function for ASP.NET MVC 2 built in data annotation javascript validation that performs the functionality of Jquery.Validate's isValid()? I'd like to check if my fields are valid prior to using jquery ajax to send data to the server? Any suggestions? Thank You. ...

Best practice for structuring a new large ASP.NET MVC2 plus EF4 VS2010 solution?

Hi, we are building a new web application using Microsoft ASP.NET MVC2 and Entity Framework 4. Although I am sure there is not one right answer to my question, we are struggling to agree a VS2010 solution structure. The application will use SQL Server 2008 with a possible future Azure cloud version. We are using EF4 with T4 POCOs (mode...

With ASP.NET MVC, what is the preferred way to Ajaxify a simple form?

I am trying to add a simple comments/message box to a web page. When the user enters the comment and hits submit, I would like to save this message to the database and add the comment to the list displayed on the page, without refreshing the entire page. However, I am not sure of the best way to do that these days. I am using ASP.NET...

ASP.NET MVC 2: Application areas and routes

So my application is growing and I'd like to split out my View-based controllers from my JSON-based controllers. Basically, I have a bunch of controllers that all they do is return JSON results for AJAX calls. What I would like to do would be to set up the routes (and the folder structure under my Controllers folder, for that matter) su...

How to parse a url string using mvc2 routes

I'd like to know if there is a simple way of building a RouteValueDictionary from a url. For example if I have a url http://www.site.com/controllerA/actionB/idC, then how can I extract the RouteValueDictionary where the item with the key controller would have the value of controllerA. Note this isn't for testing so I don't want to use m...

ASP.NET MVC Installer

Hi everyone, We need to install ASP.NET MVC on several developers machines with VS2010. Unfortunately the only files I can find in the Microsoft Download Center are labelled as ASP.NET MVC installer for VS2008. Can someone please point me in the direction of installer for VS2010, or can the VS2008 one also work for VS2010? Thanks, Dan...

What is MapRoute namespaces parameter for?

ASP.NET MVC's MapRoute method has a parameter named namespaces. From looking in the code, I see that this parameter is saved in the Route object in DataTokens["Namespaces"]. It seems to me that it has some meaning... anyone knows what is it for? ...

Can backslash be encoded correctly in URL with URL rewrite?

I am working on a ASP.NET MVC2 project. The problem is when a string which would be rewritten into URL that contains special character such as backslash or question mark. That will make the URL wrong, even I have encoded it before. For example: I have a product id "p001\2-2". I encoded it into "p001%5C2-2" The URL http://domain.com/P...

C#: convert Unicode to use as url

Hi. I'm working on multilingual Asp.NET MVC application. In url i need to use category name. Is there any way how to convert i.e japanese text to its url safe equivalent? Or should i use original text in url(www.example.com/製品/車 = www.example.com/product/car)? EDIT: I need SEO firenly urls. I know how to strip diacritics and replace spa...