asp.net-mvc

Writing Custom Attribute in C# like ASP.Net MVC Authorize attribute

Hi, I like ASP.Net MVC Authorize attribute, I can extend it and build my own logic and decorate my controller with it. BUT, In my architecture, I have one common service layer(C# Class Library). End user can access my application via ASP.Net MVC web site or via my exposed REST WCF Webservice layer. My asp.net MVC application and REST ...

Is it right to generate the javascript using C# in ASP.NET MVC view page?

[Sorry for long question but it is necessary to explain the problem] I am working on a learning website and it is supposed to show a list of messages to user if there are any. Something like this: When user presses close button, that message must be marked "read" and should not be shown next time. Following code is used to generate t...

IMultipleResults Using Custom Model & Repository

I'm following Steve Sanderson's example from this ASP.NET MVC book on creating a model by hand instead of using diagramming tools to do it for me. So in my model namespace I place a class called MySystemModel with something like the following in it [Table(Name="tblCC_Business")] public class Business { [Column(IsPrimaryKey=true, IsDb...

Multiple ASP.NET MVC projects that builds as single ASP.NET MVC Application

We want to split our large asp.net mvc web application into multiple Visual Studio projects so that each team can independently on their visual studio project. Desired structure is: ASP.NET MVC application that is responsible for the base UI Module 1 - VS Project (Does this need to be a ASP.net MVC App or .dll?) Module 2 - VS Project ...

Are there websites you can't build with ASP.NET MVC

Hello, I was about to ask this question...but since it has already asked I will ask a different one. I have never created a production website and I am thinking it is time for me to learn how. (I have simple one I can do for a customer.) I personally LOVE the Convention Over Configuration paradigm at the heart of MVC (and I perso...

Autocompleting combobox in ASP.NET MVC?

I'm trying to convert an app that I had previously written in ASP.NET Web Forms to MVC and am stuck on the problem of implementing an autocompleting combobox. Previously, I had used Telerik's RadComboBox, but I'm not sure how to make this work in MVC or if it even can be made to work. Here's the markup code I was using: <telerik:RadComb...

Abort OutputCache duration programatically in asp.net mvc

Hi, I'm using the OutputCache attribute to cache my action's html output at the server-side. Fine, it works, but now I have a situation where the content changes rarely, but when it does, it's critical for the user to see the new data the very next request. So, is there a way to abort the page cache duration programatically? Thanks ...

C# Asp.Net MVC - Combine Select Lists?!

I have these two methods below. One returns a list of manufacturers based on the handset ID and the other returns a list of Handsets based on the Handset ID (relationship via handset ID). How can I combine them to return one select list with the combined manufacturer handset value? (Bit new to MVC) SelectList GetManufacturers() { v...

How to reference css in actionlink?

A actionlink like: <%= Ajax.ActionLink("more", "myControl", new { id = item.ID }, new AjaxOptions { UpdateTargetId = "pop", OnComplete = "showdetail" }, new { @class = "search" }) Then I set css in css file like: a.search {...} a:search.hover {...} It doesn't work. If I change css name is css file as: .search {...} ...

Asp.NET MVC AjaxOptions OnSuccess fires.. too early?

I'd like to use the OnSuccess option of AjaxOptions passed as Ajax.BeginForm argument to "do something" once the response is completely received and DOM updated. As far as I can undestand from MSDN, this is what this option do. In my application, OnSuccess script fires too early, immediately after the request is sent. I put to sleep the...

Backoffice and Frontoffice to separate projects

I'm building a project using mvc framework. I'm at a point where i need to decide if I should separate frontend and backoffice to two mvc applications This is to make my solution tidy and well structured. But at the same time I don't want to increase maintenance on the long run. Can you please share with me your experience on the lon...

ASP.NET MVC - EntityFramework and Binding to a List

I am currently using the EntityFramework to bind my ASP.NET MVC project to a MySQL database and one of my entities, Product, has an Images property containing a collection of ProductImages. I have built a form to allow the user to modify a given Product and this form includes fields for editing all of the images associated to that Produc...

ASP.NET MVC Extension Methods Hint Shows The Extended Type In Param List

The hint for extension methods on a normal class file and the one shown on my aspx page do not match. The hint shown on the aspx page also shows the type that is being extended. Its annoying. Can anybody tell me what wrong with my Visual Studio? I am using VS 2008 am I missing any fixes? ...

Hybrid MVC and Web Site application

I evaluating the MVC framework for my existing application. Trying to write a sample applicaiton where I need to navigate from MVc view to .aspx files and vice versa. The application does seems to be working. Not able to figure out where I am going wrong. I have set up wild card mapping I have set up .mvc mapping I am using IIS6 I am us...

Edit Request.Form before Binding

Is there a way to edit the Request.Form before the action method binds to the parameters? I already have a reflection call to enable editing of Request.Form. I just can't find a point of extensibilty where I can alter it before binding occurs. UPDATE: So it looks like I was editing the Request.Form and didn't realize it. I was verif...

How do I filter data in MVC partialview using jQuery

How do I update data using Ajax, jQuery when I change a dropdown on my Index.aspx page? I have a page with a ProjectList dropdown which should show all issues related to that Project. If I change the return value on my Controller action, see the commented code, it either removes the master page and just loads the PartialView Or does not...

301 Redirect after a route is matched but before controller execution

I'd like to add a trailing slash to any url's that match a valid route but do not currently end in a slash, i.e. www.example.com/url After a url is matched to a valid route I would like to 301 redirect to the same url but add the trailing slash i.e. www.example.com/url/ I've spent some time looking into it but I can't seem to figure it...

Using Request.Files.Count with TestControllerBuilder from MvcContrib?

I have a controller action in ASP.NET MVC that handles uploaded files. However, it seems there is no way to call Request.Files.Count while using MvcContrib's TestControllerBuilder. I know I can work around this by abstracting Request.Files. My questions are: Is it indeed the case that there is no direct way to call Request.Files.Count...

ASP.NET MVC Aggregate CSS/JS from multiple controllers

We have a fairly complex application that was previously using WebForms. We are in the process of rewriting bits of it from scratch using MVC. Our application is comprised of a number of widgets, that together make up the functionality of the application. In WebForms, we used UserControls. Each UserControl would register its CSS and Jav...

How to initialize IDictionary in constructor?

In TagBuilder and other classes I can write something like: var tr = new TagBuilder("HeaderStyle"){InnerHtml = html, [IDictionary Attributes]} but I don't know how to pass the IDictionary parameter. How can I do that on the fly? Without creating a Dictionary variable. EDIT TagBuilder is an example, there are other classes that accep...