asp.net-mvc-2

GNU GetText in ASP.NET MVC

Hello i am looking for a guide on how i can implement GNU GetText as my translater in an ASP.NET MVC application. I have been looking for some time now, but i have not been able to find anything that was of help :( ...

ASP.NET MVC - compression + caching

I've seen a number of options for adding GZIP/DEFLATE compression to ASP.Net MVC output, but they all seem to apply the compression on-the-fly.. thus do not take advange of caching the compressed content. Any solutions for enabling caching of the compressed page output? Preferably in the code, so that the MVC code can check if the page...

ASP.NET MVC passing several data instances from controller to view

I'm trying to build an ASP.NET MVC 2 application. I want to pass data to a view from a controller. I am able to pass it when it is only a single data structure. In the controller: private ArticlesDBEntities _db = new ArticlesDBEntities(); public ActionResult Articles() { return View(_db.ArticleSet.ToList()); } an...

How to pass the id of the parent to the create view of a child

I'm new to MVC2 and my question should be pretty basic. At least I thought so until I could'nt find any answer on the web, so here I am. I have a parent object Pool that can have 0 to many children Question. In my Details view of Pool, in addition to the Pool's property, I render his childs using RenderAction on the Question action Lis...

Attaching a combobox to an arbitrary text input

I'd like to use Html.EditorForModel in mvc2. Is it possible to use some attribute to tell the view to use a DropDownList for a specific field? (without resorting to writing a template). I'm thinking something along the lines of django's "choices" option on a field. Thanks, Juan Pablo ...

BidSystem, online auction, problem with timing

Hi, guys! I'm developing an online auction with time limit. The ending time period is only for one opened auction. After logging into the site I show the time left for the open auction. The time is calculated in this way: EndDateTime = Date and Time of end of auction; DateTime.Now() = current Date and Time timeLeft= (EndDateTime -...

What are the things to absolutely check when deploying an MVC 2 web application?

Hello, I am going to deploy my first MVC web application to the internet. As is the first app with this framework for me, I was wondering if I can collect some advices regarding what should be done to prevent troubles. I am generic on the question and this is xpressely done to collect the most various answers. Thanks! UPDATE: Thank...

MVC .NET CSS not picked up by the View

Hello, I am working on a MVC2 site and am having issues getting my objects on my views to inherit the css classes. Here is my helper object and CSS that is saved in the Site.css which is linked in the master page. This also works fine if I put the CSS in a tag on the masterpage. <%= Html.ListBox("ExpenseItems", (System.Web.Mvc.Selec...

How to send Complex Data (object) from view to controller?

I'm trying to pass this Person Object from my view to controller without Form, how do I do that? Here's my attempt: VIEW <%=Html.ActionLink( "Jump", "Jump", new { name="MyName", person=ViewData["Person"]}, // lets assume ViewData["Person"] is not null null) %> CONTROLLER public ActionResult Jump(string name, Person per...

calling javascript function for ajax.actionlink

I have the following ajax.actionlink. i want to add click event to this actionlink. How can i do that <%= Ajax.ActionLink("text", "textaction", new { param = 1}, new AjaxOptions { OnSuccess = "updatePlaceholder", ...

Why does my route test fail but the route works when running the application?

I've got the default route set-up: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Shortie", // Route name "{controller}/{id}", // URL with parameters new { controller = "Ettan", action = "Index", id = "id" } // P...

Issue with ASP .Net MVC 2.0 Caching

I am using OutputCache on an Action like this: [OutputCache(Duration = 14400, VaryByParam = "none")] public ContentResult Catalog() { return ...; } and my RegisterRoutes function in Global.asax.cs contains the route: routes.MapRoute( "XMLRoute", // Route name "{site}/catalog.xml", // URL with parameters new { controller ...

Asp.Net MVC 2 Validation

Hi All I am trying to use validations with ASP.NET MVC 2. I am just validating a textbox value. Below is my approach. Create View -: <%: Html.ValidationSummary(true)%> <%: Html.TextBoxFor(model => model.Name, new { @class="input-standard"})%> <%: Html.ValidationMessageFor(model => model.Name) %> Model Property-: [Required (ErrorMes...

Using DateTime in MVC

I have the following code. dateStart & dateEnd are both DateTime. My issue is that this is generating the following url https://www.mysite.localhost/Order/Products/27?categoryId=0&amp;dateStart=09%2F24%2F2010%2000%3A00%3A00&amp;dateEnd=10%2F01%2F2010%2000%3A00%3A00&amp;allDates=0 the issue is that it's creating 09/24/2010 and not 24/09...

MVC 2 partial for edit/create return error

I got a question about MVC 2 and returning views for partials: I got two views for creating and editing a user, the views both uses a partial so i can reuse the form fields. UserPartial.ascx, EditUser.aspx, CreateUser.aspx I got some logic in the controller post method (EditCreateUser) which finds out if its a new or existing user whic...

S#arp Architecture and CRUD Scaffolding

I'm pretty sure I am a bit confused here (I'm even confused about being confused). I've already created my database in SQL Server 2008. I'm now trying out S#arp Architecture for the first time and I'm was looking into using CRUD scaffolding. From the instructions it seems like I basically have to RECREATE the entire database within the...

Why is my MVC viewModel null?

I'm trying to pass a viewModel to an edit form view. The issue is that I instanciate the model and assign values to it, but the model remains null. My Action: public ActionResult OrderEdit(takeOrder FormInput) { takeOrder viewModel = new takeOrder { Name= "anonymous", TableNumber = 13, ...

How to manage conditional enable/disable state on a mvc form?

I'm building a form with many panels and many controls (both inside and outside the panels). Panels and controls have to be enabled/disabled for edition (and probably disabled for edition with the last selected value) depending on model state, other panel's state and their own business rules validation. Until now, we have created many pa...

How can I close the jquery ui dialog from inside the dialog code?

I use several jquery ui dialogs in my application to collect input from users and for CRUD operations. When in a page I need a dialog I do the following steps: First I define the minimum markup and code necessary to initialize the dialog like this <div id="dialogPanel" style="display:none" title=""></div> and, when the DOM is ready, ...

How does ASP.NET MVC caching work for an AJAX request?

I'm just starting to look in to caching to improve performance and have a question about caching for an AJAX call. I have a action which is used to query twitter and then return the results. At the moment when a user presses a button it loads a rotating gif whilst it goes off to the action to do the query and then return a partial view....