asp.net-mvc

Questions about caching in high-traffic website.

Suppose we are building an E-commerce site that allows consumers to search for products by typing in keywords. Say there are at most 200,000 products, and there are millions of consumers using the system. Let’s say the product table is updated fairly frequently. Since the number of products is not that high and we can probably store the ...

Efficiently finding unique values in a database table

I've got a database table with a very large amount of rows. This table represents messages that are logged by a system. Each message has a message type and this is stored it it's own field in the table. I'm writing a website for querying this message log. If I want to search by message type then ideally I would want to have a drop down b...

How To improve ASP.NET MVC Application Performance

How do you improve your ASP.NET MVC application performance? ...

ASP.NET MVC - Model Validation regarding its dataType Length

Hello there, I'm using ASP.NET MVC 1 on a project where I would like to validate my form submission with the ModelBinding helpers, actually I am validating it with ModelState.IsValid but it doesn't seem to consider the dataType length when validating it. For example: I have a field nvarchar(70) called Name , but when in my form I submi...

ASP.NET MVC and JQuery Dialog postback

hi, I have a simple List view in MVC that renders some products. As soon as 1 product is selected I open a JQuery modal popup in this way: function showDetails(id) { hostId = id; $("#detailDialog").load('/Product/Details/' + hostId); $("#detailDialog").dialog("open"); } The modal popup correctly loads the partial view ...

Routing with Multiple Parameters using ASP.NET MVC

Our company is developing an API for our products and we are thinking about using ASP.NET MVC. While designing our API, we decided to use calls like the one below for the user to request information from the API in XML format: http://ws.audioscrobbler.com/2.0/?method=artist.getimages&artist=cher&api_key=b25b959554ed76058ac220b7...

How to enable only digits to enter into the Texbox on ASP.NET MVC Page?

Hi I have an ASP.NET MVC Page along with Zipcode, Phonenumber & Fax. Now i want to disable all other keys and only enable digits from the keyboard while typing on these textboxes. Appreciate your responses. As of now this is how the form is validated using Validation Plugin. Zip* <td CssClass="Form_Value"><%= Html.TextBox("Zi...

Can't get information to submit to a database

I am trying to make a simple web app. I have a User table which is just an id, name, password and email. The id is a counter so thats assigned automatically. I have a User/Create action which adds a user to the database. They fill out their name, password and email and click submit. My problem is that the field isn't submitting and what...

ASP.Net MVC unit test exception

Hello, I'm using the Moq framework to do my unit testing. I'm following some really useful instructions outlined here to help me mock the httpcontext, specifically for the purposes of testing the url referrer: http://my6solutions.com/post/2009/08/18/Mocking-HttpContext-in-ASP-NET-MVC.aspx Everything seems to compile fine, however whe...

can we use JQuery validations in partial view user control in ASP.NET MVC?

Hi I have controls like Textbox, dropdown on my CustomerDetails.ascx partialview. Now can we do JQuery validations on the user controls. In the MainView, we use code like this. <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Mvc.Master" Inherits="System.Web.Mvc.ViewPage>" %> //JQuery validations C...

How do I get the route user\22\edit in ASP.NET MVC

Hi, So I have my route setup for accepting something like user\22\edit where 22 is the ID of the user we are editing. I can type this into the URL bar in my browser and things are good to go. My questions though is how can an ActionLink on a view to have that same URL structure when clicked? Thanks ...

Working with a list of checkboxes in an ASP.Net MVC View

I have three tables in my database: Pages, Tags and Joiner My entities look like this (abbreviated)... public class Page { public int PageId { get; private set; } public string Title { get; set; } public string Body { get; set; } public List<Tag> Tags { get; set; } } public class Tag { public int Ta...

How do i get ninject 2.0 working with asp.net mvc 2?

Hello, i am using:- asp.net mvc rc 2 Ninject and ninject asp.net mvc extension (http://github.com/enkari/ninject.web.mvc) i keep getting the 'No parameterless constructor defined for this object.' for my AccountController. The AccountController is injected with Services. The bindings for these services are defined in the ServiceModu...

Jquery $.ajax callback not being called in ASP.NET MVC View Page

I have a simple ajax call: $.ajax({url: my_url_here, dataType: 'text', success: function(data, textStatus) { if(textStatus == "success") { alert('success'); } else { alert('fail'); } }, error: function(XMLHttpRequest, textStatus, ...

JQuery validation problem with Textbox naming on ASP.NET MVC page?

Hi I have two Textbox controls on my view. Here JQuery validation function is working when the name is one word. It is not working when the name is having any dots in it. In the below JQuery fucntion, if i use "lastname" textbox id for validation, it is not allowing any other keys except digits. But somehow if i use "AddressDetail.ZipC...

MVC.NET milliseconds get lost when using Html.hidden on a DateTime LastUpdated column for version tracking

Question in short: How tot do this in MVC.NET? Question in long version: Im trying to use a DateTime column in a SQL Table for version tracking (this in itself is proposed as a solution to re-attaching a Linq2Sql data class after being passedback by a editview for the table) But now i get 'row not found or changed'-exception. on the ...

MVC Custom Model - Where is a simple example?

I need to make a web application and I want to use MVC. However, my Model can't be one of the standard Models -- the data is not stored in a database but instead in an external application accessible only via a API. Since this is the first MVC application I've implemented I'm relying on examples to understand how to go about it. I can...

ASP.NET MVC Route not working with constraint

Hi, I'm having trouble getting a Route working in order to constrain the parameters of an action of a controller to only be integers. I have a a controller action as follows: [RequiresRole(RoleToCheckFor = "Administrator"), AcceptVerbs(HttpVerbs.Get)] public ActionResult Edit(int id) { ... } and the following ...

JQuery validator plugin problem on update button click on ASP.NET MVC Page

Hi I am using JQuery validator plugin on ASP.NET MVC Page as below. 1). Here on update button click, Validation messages are displaying fine. 2). Zipcode Min length is 5 and max is 9 and is a required field and only digits. The problem is even if we enter more than 9 digits, it is displaying the validatin message and but updating it ...

How to bind a prefix to a complex model?

I'm trying to bind a prefix to a complex type... any idea how? e.g. instead of this... public ActionResult Index([Bind(Prefix = "ids[]")] IList<long> ids) { ... } i want to public ActionResult Index(ComplexModel model) { ... } where the model is something like public class ComplexModel { [Bind(Prefix = "ids[]")] // <----- t...