asp.net-mvc

Nested forms in ASP.NET MVC

I have a shopping cart where the following are true: There is one "Remove" button for each product in the shopping cart There is one editable quantity text box for each product in the shopping cart There is one "Update" button for the entire shopping cart The idea is that the user can modify the quantities for each product in the car...

.NET MVC Write Cookie from ActionFilter

Hi, I built an ActionFilter to host a page hit logger on my MVC site and have the need to save some values into cookie. I've used the following code to write the cookie: public class LogRequestAttribute : ActionFilterAttribute, IActionFilter { void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext) { if(...

ASP.Net MVC Linq Grouping Query

I am getting the last 20 updated records in the database by using the following var files = (from f in filesContext.Files join ur in filesContext.aspnet_Roles on f.Authority equals ur.RoleId join u in filesContext.aspnet_Users on f.Uploader equals u.UserId orderb...

ReadOnly Session State in ASP.NET MVC

Is there an equivalent to EnableSessionState=”ReadOnly” in ASP.NET MVC? This directive was originally used in ASP.NET webforms but I find no trace of it in MVC. ...

Convert from Local Client System's Time to CST and vice versa

I need to store the datetime in CST timezone regardless of any timezone given. The Clients who access the application are from from various time zones, like IST, CST, EST,... I need to store all the datetime entered by the client in CST timezone to my database. And while retrieving, i need to convert back to there local timezone. How ...

MVC: How to have a View display from within a div

Hi there, In my MVC project indide one of my views I have some JQuery that pops up a dialog whos content is defined within a tag Is there a way that I can ensure the contents of the is a View/PartialView which is populated from my controler along the lines of: public ActionResult PopulateDivContent() { MyBusinessEnti...

ASP.NET MVC: Is Data Annotation Validation Enough?

I'm using the Data Annotation validation extensively in ASP.NET MVC 2. This new feature has been a huge time saver, as I'm now able to define both client-side validation and server-side validation in one place. However, while I was doing some detailed testing, I realized that it's quite easy for someone to bypass the server-side valida...

ASP.NET MVC: Uses a delegate field as an action method?

Is it possible in ASP.NET MVC via some extension/override points to allow a "delegate field" to be used as an "action"? Something like: using System; using System.Web.Mvc; namespace Company.Web.Controllers { public class SwitchboardController : BaseController { public Func<ActionResult> Index, Admin, Data, Reports; ...

ASp.Net MVC Default Route

I have my default route defined like this routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ...

Show SQL executed per request in ASP.NET MVC using LINQ to SQL

Is it possible to show the SQL that was executed for a particular request in an ASP.NET MVC app? I would like to show how many queries, and what they were on the bottom of pages during debugging. ...

ASP.NET MVC Action links in own class

Hi, I need generate action links outside controllers. I can use Html.Action in Views, Url.Action in Controllers. That's fine but... I have my own class where I want generate HTML code for site menu, which is used in site.master. But how can I generate action links in my own class? Possible solution is to generate this HTML code in Bas...

Best method for importing csv or excel file to SQL Server 2005 using .net MVC view

Hi, I'm looking for the best method for importing csv or excel file to SQL Server 2005 using .net MVC. Thank you. ...

ASP.NET MVC Dotfuscator problems

Hello, I am trying to use Dotfuscator (CE) to help protect our ASP.NET MVC .ddl. Its a web application that will be distributed to clients and we need a way to protect our IP. The problem is that it appears to break the application once completed. I've only got so far with disabling renaming on my Controllers namespace but I'm get null...

Asp.Net Mvc 2 reusable parts?

Hi there: I wonder, is there an equivalent of the Monorail View components for Asp.Net MVC? What I m trying to do is render some complex UI that depends on a class, so say we are in a List view, I want to pass an object to this ViewComponent equivalent and that it will take the object as a parameter and render the complex UI for me all...

Certification for Asp.net MVC

Is there any certification aimed at Asp.net MVC developers? Either from Microsoft or any other vendor? EDIT: If there's not are there any plans to be? ...

Asp.Net MVC Ajax and loading aspects of the page (View)

I've got a nice MVC app running now, and I'm adding some AJax functionality. I have a table which displays 10 items, only certain users can see certain items. When the user adds a new post I've set-up the ajax to save the new entry. However I then need to update the table, I cant find out from JQuery what status the user is (And hence ...

view data dictionary overriding Model data in asp.net mvc

Hello gurus, I have a view to create a user as follows: <% using (Html.BeginForm("SaveUser", "Security")) {%> <p> <label for="UserName">UserName:</label> <%= Html.TextBox("UserName") %> <%= Html.ValidationMessage("UserName", "*") %> </p> <p> <label for="Passwor...

JQuery datepicker - set callback order

I'm using the JQuery datepicker and show it to the user with some days disabled. Certain users in my site can mark some days in an agenda as 'being available', their working hours so to speak. Their availability has to be reflected in the calendar to other users. I have searched the web for this, and it seems that one should use the bef...

Set Culture in an ASP.Net MVC app

What is the best place to set the Culture/UI Culture in an ASP.net MVC app Currently I have a CultureController class which looks like this: public class CultureController : Controller { public ActionResult SetSpanishCulture() { HttpContext.Session["culture"] = "es-ES"; return RedirectToActio...

Trigger an asp.net mvc ajax refresh automatically every X minutes

I have a Refresh button on my page that will perform an asp.net mvc ajax post to update some of the content on the page. The refresh/update process can be long running (about 10-20 seconds). Right now the user has to manually click the Refresh button to trigger the refresh. I want to trigger the refresh automatically every X minutes. ...