asp.net-mvc

why does jquery ui dialog break asp.net mvc's default model binding . .

i just took the demo jquery UI dialog (model dialog) sample and tried to include it in my asp.net mvc project and i have observed something weird. If you have content inside a jquery ui dialog div tag, the default model binder doesn't pick it up during posting to the server as it if removed these elements from the form the full view...

Best way to hide Table or Grid and display No Records Found Message with ASP.NET MVC ?

Hi, What is the best practices for hiding a custom grid or a table or a div and display a "No Records Found" message when there are no records. I ve come up with this idea <div class="<%= Html.IsVisible(Model.Count)"> ... .. .. </div .displayNone {display:none;} .displayInherit {display:inherit;} public static str...

MvcHttpHandler doesn't seem to implement IHttpHandler

i'm trying to do a custom ActionResult for a MVC controller. In the example i'm looking at it shows the snippet bellow. My System.Web.Mvc.MvcHttpHandle doesn't implement the IHttpHandler interface. The System.Web.Mvc.dll is version 1.0.0.0. Should i just write my own httphandler or is there something specific to the MvcHttpHandler that i...

ASP.NET MVC 2 user control caching

Hi guys, I've recently decided to try out MVC 2 and coming from a webforms background, I'm having a little trouble trying to figure out the best practice solution to caching data provided to a partial view (user control). In my webforms application, I have an AccountSummary.aspx page, which has a Booking.ascx control. Booking.ascx had ...

Problems with OpenForum Index.ascx?

This is the ascx page: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<OpenForum.Core.ViewModels.IndexViewModel>" %> <%@ Import Namespace="OpenForum.Core.Views.ForumViewHelper" %> <div class="openforum_container"> <%= (Model.IncludeDefaultStyles) ? ForumViewHelper.GetDefaultStyles() : ""%> <%= (Mo...

SWFUpload Authentication

I am using SWFUpload to do file uploading in a ASP.NET MVC 1.0 website. It is working fine, but I am not able to authenticate the upload method. The HttpContext.User.Identity.Name returns an empty string. I am assuming this is because the Flash movie is making the post. I am also using the wrapper provided here: http://blog.codeville.net...

protecting files with asp.net (mvc)

I want to protect the files in a specific directory so that people cannot link to them - but I still need my program to be capable of rendering them, so password protecting the actual folder won't work. Is there any way to facilitate this in ASP.NET MVC? Obviously it's more about ASP.NET, not MVC - but I can't make use of things like Ses...

How to define this route in ASP.NET MVC ?

Hi, I have a controller named Movie, with an action named ByYear, which takes the year as a parameter : public ActionResult ByYear(int year) { ViewData["Title"] = string.Format("Movies released in {0}", year); var repository = MvcApplication.GetRepository(); var movies = repository.Medias ...

data persistenc in asp.net mvc controller

Hello, i want to keep a List in the controller. and manipulate it via action the being invoked from a view page. currently i'm losing the data of the List on each request. what is the correct way to do that in ASP.NET MVC Thanks ...

Build a Forum in Asp.Net MVC

Is there a tutorial or a VERY simple forum dll on how to build a forum from an ASP.NET MVC application? I am trying to publish a site for a semester project, but a requirement is that it must have a forum. ...

ASP.NET MVC : Context sensitive validation.

I have bunch of action-methods that need to verify the ownership of the orderId passed to the action something like: public ActionResult CancelOrder(int orderId) { If (!MyDatabase.VerifyOwnership(orderId, User.Identity.Name) return View("You are an imposter!"); // ... } What's an easy way to verify orderId belongs to User.Iden...

Visual Studio development server serving HTML content type. How can I switch to XHTML?

I'm having the problem described here, which is caused by using , when the page being served has content type "text/html" instead of "application/xhtml+xml". Where can I switch VS2010's web server configuration to serve XHTML? ...

asp.net mvc strongly typed helpers - should your render binding object be the same as your posting object ?

i see that asp.net mvc 2 has strongly typed helped and looking initially at the way it works i think maybe i am doing something wrong in asp.net mvc 1 in terms of data binding to render the view and post back to the controller. I often have different objects for rendering the view and posting back to the controller. is this wrong ?? It ...

Model binding in ASP.NET MVC when editing an entity

Hi, i am kind of stuck with this code: [AcceptVerbs(HttpVerbs.Post), Authorize] public ActionResult Edit(FormCollection collection, [Bind(Exclude="Id,Latitude,Longitude")]Store bindStore, string Latitude, string Longitude) { Store st = storeModel.GetStore(Session["user_id"].ToString()); bool modelUpdate = Tr...

How do I handle a filtered and unfiltered list in the same asp.net mvc view?

Hi everyone, I need a way to display whether a user has subscribed to a service or not and to display it into a table in a view. So far I am able to show if that a user has subscribed to a service but am not able to show when they have not subscribed. I created a viewmodel like this: public class MyServicesController : Controller...

ASP.NET MVC - Local Resource Issue

Hello, I am having an issue when attempting to override the DisplayNameAttribute in ASP.NET MVC to provide a localized string. The code itself is straightforward and similar to that in another Stackoverflow post link text The code works for global resources but not so well for local resources. I have a registration screen and used the ...

When should I create new Controller class in Asp.net MVC (Design Question)?

Hi all, Before I ask the question, here is my understanding about Controller in MVC pattern. Controller is Application Layer (in DDD) It controls Application flow. It is kept thin It controls unit of work (a.k.a Transaction) My question is "when should I create new Controller class?". I'll take an example as DinnerController in Nerd...

ASP.NET MVC 1.0 Validation with xVal

I'm actually fine with using another validation method. It seems there aren't many options prebuilt for doing validation with ASP.NET MVC 1.0. The main thing I see people talking about is xVal. However, there is literally no documentation for it. In fact, the blog of the founder seems to only have like two posts on it. Anyway, it's the...

I need some really good blogs to follow ASP.NET MVC, Fluent NHibernate, and Spark View Engine.

I need some really good blogs to follow ASP.NET MVC, Fluent NHibernate, and Spark View Engine. I would like to follow some good bloggers in these areas. ...

ASP.NET MVC bind array in model

This is somewhat a two-part question (please let me know if they should be split up). 1) I have a model class with an array of objects contained inside it. I would like to be able to bind this automatically so I can accept a single pollModel argument in my controllers. public class pollResponseModel { public long id { get; set; } ...