asp.net-mvc

PDF Previewing and viewing

I'm creating a document viewing web application. You log in and it takes you to a screen where you have all your docs listed on the left. I want to make it so that when you roll over a document a preview of the document shows up on the right. From there you can click on it for a full view and printing capabilities. I'm not asking how...

Mocking a HttpContext Response.Output with Moq

I've been using the MvcMockHelpers class found at Hanselman's blog for passing in a mocked HttpContext. We extended it somewhat to add some authentication data we needed and for the most part this has been great. The issue we are having is that the context we are giving to the controller has a null value in the HttpContext.Response.Outp...

Visual Studio Vs Visual Web Developer

I am trying to write a web application using ASP.NET MVC. I prefer C# as the programming language. Which IDE is better to use for this purpose? Visual Studio or Visual Web Developer? What are the features of the IDEs? What are the benefits of using one over the other? Thanks in advance. ...

ASP.NET MVC - handling multiple objects in one form

I have a scenario I'm stuck on - I have a domain object that has a collection of objects attached to it. Something like this: public class Person { public string Name { get; set; } public IList<PhoneNumber> PhoneNumbers {get; set; } public IList<Address> Addresses { get; set; } } The UI the client wants has a single input fo...

asp MVC Ajax : How do I run javascript method after InsertionMode completes

I have an mvc ajax form that inserts text into an element with InsertionMode. I also want to run a javascript method after that completes but if i use "OnCompleted", the insertion does not occur and the text is put in another browser content page. How do I run a javascript method after the Ajax InsertionMode has finished? ...

ASP.NET MVC : Null property values in model ?

Considering the following view excerpt : <%= Html.TextBox("Something", Model.Property.SubProperty.Value) %> I can handle the case when Property and SubProperty are null with : <% if( Model.Property != null || Model.Property.SubProperty != null ) { %> <%= Html.TextBox("Something", Model.Property.SubProperty.Value) %> <% } %> But I d...

Inserting item in LINQ to SQL datacontext - doesn't appear until application restart

I have an ASP.NET MVC (using the release candidate) application that works with a class library that among other things uses LINQ to SQL for data persistance. One of the thing the app/db maintains, is the concept of a "Folder" - like a disk folder, but with a hierarchy that only exists in the database. Other database objects live in the...

Can't Submit Form With Simple Validation with the JQuery Form Plugin

I am using the jQuery Form plugin to submit AJAX requests. I am trying to do some simple validation (make sure fields are filled out) before submitting. I am not trying to run any AJAX validation prior to submission. Before I added beforeSubmit to the options of the ajaxform() method, the form would submit and my controller code would ru...

ASP.NET MVC UserControl requires css/javascript

I have a user control (a user details form) which has a lot of javascript and css attached to it. i'm struggling to make my control decalre that it needs a certain file so it will be included in the "head" section of the html. I also wonder what happens if i enter mutiple instances of a control (the is no InamingContainer or anything si...

In ASP.NET MVC, preserve URL when return RedirectToAction

I have an action method, and depending on what is passed to it, I want to redirect to another action in another controller. The action and controller names are determined at run time. If I return RedirectToAction(), it will force a redirect and change the URL in the browser. What I would like is something like TransferToAction() tha...

How to make not-null varchar columns to be required to be not empty in ASP.NET MVC validation?

So I'm using ASP.NET MVC RC1 and using the DefaultModelBinder's validation to show validation errors when not-null integer fields are not set to a value. This is done by default by MVC. However the same is not true for string(varchar) fields, because the binder is passed an empty string from the view, which is completely valid for a no...

ASP.NET MVC: when posted Upload File, it is null in action method

In the View page, code is below: <% =Html.BeginForm("About", "Home", FormMethod.Post, new {enctype="multipart/form-data "})%> <input type ="file" name ="postedFile" /> <input type ="submit" name ="upload" value ="Upload" /> <% Html.EndForm(); %> In the Controller, something like this: [AcceptVerbs(HttpVerbs.Post)] public ActionRes...

MVC RC How to configure UserControl without codebehind?

In the RC without CodeBehind, how do i wire up the ascx with the View if I am passing a model to it? MY CSS CLASSES ALL SAY UNDEFINED. ...

Looking for commercial UI rich controls for ASP.NET MVC

I'm looking for a commercial suite of rich UI controls for ASP.NET MVC. (commercial suites, I know jQuery has a lot of free stuff) This means no postbacks. And preferably built with jQuery. some webform examples: www.infragistics.com http://www.componentart.com/ ...

HTML Page Layout Looks Fine in IE7 but not IE6

I have an ASP.NET MVC View that works great on IE7, but looks really crappy when I try to view it with IE6. With IE6, the white area of the page (the ContentPlaceHolder part) is bunched over to the right and does weird things like move around when I resize the window. I have looked in the .aspx, Site.Master, and Site.css to see what is...

MVC + Entities Framework: Many to Many relationships

Hi folks Im new to MVC and EF. I have a basic app that lists info from a few (4) tables relating to some servers. One of the relationships is a many to many (Servers to Roles). I pass my ViewData to the View by making use of this in the controller: ViewData.Model = (from s in _db.Servers.Include("Locations").Include("OperatingSystems"...

ASP.NET MVC performance has suddenly become very slow

I'm using Billy McCafferty's rather excellent S#arp Architecture. Everything was spiffing and running very quickly. I then updated to the the latest ASP.NET MVC RC. This meant I had to get the latest trunk of S#arp. Also, two weeks ago, I updated from XP to Vista (32 bit) My problem is that the performance has suddenly become woeful...

asp.net MVC - ValidationSummary not displaying

Hi All I have a strange problem whereby the ValidationSummary is not being displayed. However, the ValidationMessage's are being displayed. I've checked the output page source and it's not as though they are in a colour that is obscuring them. I'm using the RC. Any ideas? Edit: Break point set at ValidationSummary shows: ViewData.Mode...

Hybrid WebForms/ASP.NET MVC

I am kinda new to .NET applications, I have a web forms application that I am working on and I am about to start the development of new pages, I am trying to make the new pages with the ASP.NET MVC, but I am not beeing able to make the pages hit the controllers. First i added the library references added the routes on the global.asax but...

ASP.Net MVC Redirect To A Different View

Is it possible to redirect to a different view from a controller? For example in this case all my controllers inherit from a custom controller that has a contructer that I want to redirect to different view if certain criteria is not meet. Hope that makes sense. Thanks ...