asp.net-mvc

ASP.NET MVC - How to get current action from within a partial view?

I have a partial view that is rendered by several views which are returned by several action methods. The partial view has a form that should post back to the called action method. It is my understanding that if i just call <% Html.BeginForm(); %> from within a view, the form's action attribute will point to the called action method...

html.ActionLink links not returning expected value?

I have the following ActionLink Html.ActionLink("Home", "Index", "Home", New With {.class = "tab"}) But it creates the following Link in the address bar http://localhost:1028/?Length=4 as opposed to what I expect it to be as http://localhost:1028/Home. Have I done something wrong to cause this? ...

How to get current virtual path in ASP.NET MVC?

How do you get the current path (url) from within an asp.net mvc view? If there isn't a way to get it in the view, how can you get it in a controller so that it can be passed to the view? EDIT I don't want the protocol and host portion of the url. ...

ASP.NET MVC DropDownLists and foreign keys

I am using a drop down list in my MVC app to select from a set of areas for editing or creating an entry the code looks like this: <%= Html.DropDownList("LocationID", ViewData["Areas"] as SelectList) %> ViewData["Areas"] = new SelectList(AreaHelper.Areas, tablet.LocationID); I am having issues with saving and updating the current loc...

Where to put Data needed in several PartialViews

Hello, Imagine I have a PartialView displaying a list of articles. And I have a Repository/DAL function get me the newest (or whatever) 100 Articles. Now I want to display these articles using a grid in 5 columns. How can I display the first 5 in the first column, the next 5 in the next column an so on using that partial view. Ok I coul...

xVal vs ASP.Net MVC Validation toolkit?

Does anyone have any recommendations for either of these validation ASP.Net MVC Validation frameworks? xVal MVC Validator Toolkit ...

How to get and set http headers in an Action, the testable way

I have an action that returns either a FileContentResult or a NotModifiedResult, which is a custom result type that returns HTTP 304 to indicate that the requested resource has not been modified, like this: [ReplaceMissingPicture(Picture = "~/Content/Images/nothumbnail.png", MimeType = "image/png")] public ActionResult Thumbnail(int id)...

MVC - Linq - Populate List<T> with Records in Another Table

I'm prototyping my first MVC application, it's a simple forum. I've done part of the domain model and I'm trying to figure out how to do something that's pretty basic in SQL alone, but I can't figure it out in my application. Here are my Entities: [Table(Name="Users")] public class User { [Column(IsPrimaryKey=true, IsDbGenerated=t...

Page content disappears with ASP.NET MVC + jquery

I downloaded the jquery files and tried to include them in my Site.Master, and the result is that the page html disappears in both IE and FF. <script src="Content/jquery-1.3.2.min.js" type="text/javascript" /> <script src="Content/jquery-ui/js/jquery-ui-1.7.2.custom.min.js" type="text/javascript" /> Firebug shows the first js file, bu...

How can I testrun my SSL-Required ASP.NET MVC Website in Visual Studio?

My ASP.NET MVC application enforces the use of SSL (nothing happens at all over plain HTTP) - session cookies are required to be SSL & HttpOnly; my authorization module checks that no communication goes in or out over anything except HTTPS. The problem: How do I debug/step-through in Visual Studio now? I still want to be able to do F5 q...

ASP.net MVC Dropdownlist Troubles

I am having a bit of trouble with A dropdownlist that is supposed to be populated with values that correspond to ID keys in a database. So ideally i want something that looks like this in the dropdown list value="0" USA value="1" ETC and my code behind looks like this public TabletViewModel(Tablet tablet) { Tablet =...

Dynamic Masterpage Declaration - ASP.NET MVC

I'm attempting to create themeing system for my asp.net mvc application. I was able to create a custom view engine and a custom controller class to change the way views are output. My issue is masterpages. Is there a way to do this following: This is the @Page directive of the view <%@ Page Title="" Language="C#" MasterPageFile="<%= ...

Intercept All Relative Paths

Is it possible to intercept all and any relative paths used in an application and remove/edit a portion of it before the absolute path is evaluated? Example: In mvc view page- <%= Html.Image("~/{somefolder}/logo.png") %> I want to intercept the relative path "~/{somefolder}/logo.png" and replace "{somefolder}" with a folder locatio...

XVal, JQuery Validate, and Ajax oh my!

I'm using xVal with MVC and jquery validate. It all works nicely, until i get to my custom validator that does an ajax call. the ajax call returns the right value, according to the firbug Net Tab. But something is going wrong and I can't figure it out. Here's the javascript code: function CheckEmail() { var res; $.a...

Execute Javascript inside a partial view in ASP.NET MVC

I use this JavaScript code inside the head tag in order to populate the divs with a browse button so that users can upload images (swfupload). <head> ... <script type="text/javascript"> var swfu = function() { return new SWFUpload({ // Backend Settings // settings go here... // Too long to...

Visual Studio 2008 Asp.net MVC and Run as Administrator

In my visual studio asp.net mvc applications I have 4 build configurations; one is to use IIS as the web server, which requires "run as administrator" when running visual studio. So I ran as admin and created some new files. I have a multi-project template that I use for all my web applications. So I copied the new files from the projec...

HttpModule for Error Handling and Missing Images

I have an HttpModule that I have put together from cobbling a couple of different sources online together into something that (mostly) works with both traditional ASP.NET applications, as well as ASP.NET MVC applications. The largest part of this comes from the kigg project on CodePlex. My problem is in dealing with 404 errors due to a...

Session state in asp.net mvc

I would like to know how to use session state in a simple log in log out in asp.net mvc.. I have a code here in my controller that I've retrieved from my mysql database for my session log in..but I don't really know how to manipulate it.. <AcceptVerbs(HttpVerbs.Post)> _ Function Index(ByVal username As String, ByVal password As String,...

Can I share controller of ASP.Net MVC with WinForms Application and how?

I am developing web application using MVC. A lot of efforts are going into the design model and controller. I know I can reuse the modal in winforms. But can I reuse the controller in winforms ...

ASP.NET MVC Change Response Header when Serving Javascript/CSS Files

Is there a way to automatically change the response header in ASP.NET MVC when the browser requests a Javascript or CSS file? Basically, I want my Javascript and CSS files to be served with this set explicitly on in the response header: Cache-Control: public Help? ...