mvc

ASP.NET MVC Create querystring from form

I am trying to create a simple search box that results in something like http://www.example.com/Search?s=searchTerm I have the routing setup so that it accepts a url like this, and does the right thing. The problem I'm having is getting the form to create the querystring. I have tried many variations of: <% using (Html.BeginForm("Sear...

Is there a way to process an MVC view (aspx file) from a non-web application?

I have a background service running which sends out emails to users of my website. I would like to write the email templates as MVC views, to keep things consistent (so that the same model can be used to send out an email as to display a web page). Unfortunately, when I try to do a LoadControl (which simply patches through to BuildMana...

java swing vs mvc: is this pattern indeed possible?

Hi, I am new in swing, but managed to create a descend gui. My problem though is that I was not able to apply the patterns suggested in references/tutorials, mainly the MVC pattern. Is it me, or in JTree and using SwingWorker, it is not possible to have a clear separation of controller/view/model? For example I use a Swingworker, but t...

MVC Default Model Binder - Bind a Multiselect Dropdown to an IList<T>

I'm using MVC 2.0 in an ASP.NET application using NHibernate. I have a working View, Controller and data access layer using NHibernate that is able to display and save an entity with a relationship to another mapped entity: Person -- > Location It's using the HTML helper HTML.DropDownListFor() to display a list of all Locations. The u...

silverlight RIA deploy not working on windows azure due to the fact internal role instances are on port 20000.

I have a Silverlight/RIA application that worked fine locally and on my IIS 7 server. Now that I've moved it to Azure, I'm getting EndpointNotFoundExceptions. Can you provide me with any help to try to figure out why this is happening? [EndpointNotFoundException]: There was no channel actively listening at &#39;http://rd00155d3a15d6:2...

Limit access by Controller or by Model?

I'm just starting to sketch up the base of a web-based system, and I would like the admin to have the possibility to limit access either by Controller or by Model. My problem is, I can't decide which one (or both?) of them I should go with. Any ideas? Pros/Cons? First I was leaning towards doing it in the Controllers, seeing as they "co...

How do I use JQuery Validation in ASP.NET MVC?

I'm trying to use the JQuery Validation's "addClassRules" method in my ASP.NET MVC application. In my master page I'm including the following files... <script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript"></script> <script src="<%= Url.Content("~/Scripts/MicrosoftMVCAjax.js") %>" type="text/javascrip...

File does not exist. MVC 2

I've got a basic ASP.NET MVC2 site which logs a single "File does not exist" error every time a view (not partial views) is loaded. I am pretty sure this is because I'm referencing a file, from the master page, that doesn't exist - but I can't figure out which one it is (it's getting late here!). The stack trace is not at all useful (se...

Where to store feedback UI data in ASP.NET MVC 2?

Hey guys I'm really new to both ASP.NET MVC and the MVC pattern generally. For context, I'm currently running .NET 4.0, MVC 2. I know that MCV 2 has a bunch of built in features for: validation (both client and server side, through a variety of ways) error handling (via attributes and other methods) But what should be used to retu...

Should model objects be flexible

Hello, [Sorry but work is proprietary so I cannot give details of objects] I am working on a Java application with a colleague. I am doing the client side and he is writing the server code. The application displays a table of X objects. The columns of the table show some of X's attributes. In addition we have a column that shows a cou...

MVC: Where should I format data?

Hi, I get data from Model (an array with data) and I need to display with a specific format. I need to iterate over the array, format the data and then display it. Where should I format data to display? In Model, Controller or View? Thank you. ...

What should my ASP.NET MVC Controllers represent - "real world" application.

I have an established web application built as an ASP.NET 3.5 Web App. We recently modified it to mix MVC into the app for some new functionality. Now that it's in there, we want to leverage MVC wherever possible to begin to "transform" the app from clunky webforms to a more maintainable and testable MVC app. The question that just cam...

MVC best practice question

Hello! I have a question regarding MVC design, based on the Stanford iPhone lectures. I have 3 classes; Polygon - this holds information like number of sides and so on. This is my Model class Controller - this responds to things like button presses in the view and then calles methods in the model to increase and decrease the number ...

getting the selected value on an asp.net mvc selectlist

Hello, I'm failing at getting the selected item on a mvc dropdown list. I can't stand viewdata, and every example uses it. Here is my code, thanks in advance. //controller public ActionResult Register(Models.Person APerson) { } public class Person { public Person() { using (var mod...

FormsAuthentication: how to specify different cookie names for specific subdirectories/MVC controllers?

I'm using FormsAuthentication (with cookies) for users authentication, with the default cookie name (".ASPXAUTH"). What I need is a different login system for the "/Admin/" virtual directory (backed by an ASP.NET MVC controller, "AdminController")... as if the "/Admin/" directory was another web application, but without creating another...

Do you need deep knowledge in databases when using an abstract layer in your application.

Most(if not all) of the MVC frameworks provide an abstraction layer over the database and except in some very special cases you do not need to write SQL code by hand. Of course you need to know basic things to design your model but do we need deep knowledge how to optimize queries, make triggers and other db stuff. ...

.NET MVC Timed Events & Temporary Data Storage

Hi all, I'm relatively new to .NET MVC (c#) development. I'm aiming to code up a simple timed quiz, which extracts a numerical value from the database, sets an individual timer for each user doing the quiz (using aforementioned extracted value), and then loads a set of questions from the database - (I'm not concerned with the data extr...

Capturing Inline Expression Result

What I need to do is capture the result of an expression within an MVC view (sample below). I have also provided a stub Processor demonstrating what I want to achieve. Basically I want to divert the Target of the Action into some arbitrary string buffer that I can manipulate later. However the Target property is readonly. Can this ...

Not getting updates in MVC View following a post method

Not getting updates in MVC View following a post method Hi, Here's my controller code: public ActionResult Search() { ForecastManagementViewModel viewModel = new ForecastManagementViewModel(); viewModel.JobDate = System.DateTime.Now; return View(viewModel); } [HttpPost] public ActionResult Search(ForecastManagementViewMo...

Dynamic markup with MVC

Hi all, I have markup stored in a database, which I am pulling out and placing onto a page. below is a basic sample of what I have, without any db calls for ease of example; The controller: ViewData["testMarkup"] = "I was here <%= DateTime.Now.Year %>"; The View: <%= ViewData["testMarkup"] %> now this out puts: I was here and no ...