asp.net-mvc

Asp.net .aspx and MVC Co-existing project, the Codebehind/Codefile still existing inside .aspx files after project published

We have Asp.net .aspx and MVC Co-existing project, Codebehind/Codefile are still existing inside .aspx files after project published, it needes a lot of effort to get rid of these after deployment: we have to manually change every .aspx file <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/xxx.master" AutoEventWireup="t...

ASP.net MVC Areas and creating an ActionLink with ID (SEO / clean URL)

Hey Stackers! I am building a Help Desk Ticket system for a client using ASP.NET MVC 1.0 / C#. I have implemented Steven Sanderson's "App Areas in ASP.NET MVC, Take 2" and it is working great. In my Globabl.asax page I have some routes defined as such: public static void RegisterRoutes(RouteCollection routes) { // Routing config ...

Html Helpers Available in ASP.NET MVC controller?

I want to use the Html Helper class to build, for example, an Html.ActionLink from within a controller action. I don't see it available from within controller actions. What am I missing? ...

Visual Studio "Convert to Web Application" and "Could not load type" errors.

I'm currently getting a "Could not load type UI.Administration.Site.master" error message and I'm not really sure as to why. I have an ASP.NET MVC Project with the UI namespace. Within the project's structure, I have an Admin folder. I right clicked on the Admin folder and chose "Convert to Web Application", but am getting a Could Not...

Lightweight Rich Text Editor

I am looking for something very simlar to the SO WMD markdown editor that is extremely lightweight but I would like the text area to display the "preview" as you type. I have looked into many Rich editors but they are all seem to do everything under the sun. All I really want is Bold, Italic, Link, Image, and Lists (ordered/unordered). ...

How to display validation errors on a page with multiple forms in ASP.NET MVC

I have a top-level page called ReceiveItem. Within that page, I have a couple different FORMs - only one of which will be filled out and submitted (depending upon how that item is received). This all works quite well from the UI perspective. Here is the general page structure: <ReceiveItem.aspx> <ReceiveNewInventory.ascx> <Recei...

Rendering a view to a string in MVC, then redirecting -- workarounds?

Hi -- I can't render a view to a string and then redirect, despite this answer from Feb (after version 1.0, I think) that claims it's possible. I thought I was doing something wrong, and then I read this answer from Haack in July that claims it's not possible. If somebody has it working and can help me get it working, that's great (and...

Good asp.net mvc (VB) books

Are there any good MVC books using the VB language? Thx... ...

Multiple web projects, (almost) same layout in Visual Studio

Hi guys. Im currently developing an application with two web projects (MVC): Frontend Backend These two are going to have almost the same layout (few minor changes). Therefore I thought about creating a MasterPage, they can share. But since it's two projects in two different locations, where should I put the masterpage, images and j...

Shortening URL params with MVC routing.

I have a url along the lines of this: example.com/profile/publicview?profileKey=5 and I want to shorten it to this with routing example.com/profile/5 How do I do this? This is my attempt: routes.MapRoute( "Profile", "Profile/{profileKey}", new { controller = "Profile", action = "PublicView", profileKey ="" } ); B...

html helpers ASP.NET MVC DropDownList in .aspx in VB language

There is very little code out there that is in VB, and i'm getting stuck all the time. Can someone tell me the VB equivalent of this C# code? Thx... <%= Html.DropDownList("WillAttend", new[] { new SelectListItem { Text = "Yes, I'll be there", V...

ASP.NET MVC protected members area with sensitive data in URLs

Assume an ASP.NET MVc application has a protected members area. Some URLs generated contain sensitive data, for example Accounts/123, 123 being the sensitive data such as an account number. If the users machine later got compromised the attacker could not get to Accounts/123 as this would be protected, but they we have obtained the users...

The call is ambiguous between the following methods or properties (bug??)

Create a new ASP.NET MVC Web Application Create an ASP.NET App_Code Folder Inside the new folder, create a class with an Extension Method. For example: static public class BugMVCExtension { public static int ToInt(this string str) { return Convert.ToInt32(str); } } Choose a View and try to use this new Extension ...

ASP.NET MVC: Ugly code needs refactoring (returning three values)...

Hello, I've been brooding over a design issue (smelly code kinda thing) for a couple days now. Maybe you can help. I have a "Login" Method in my RegistrationService, and currently it looks simplified like this: public Boolean Login(String username, String password, out String successRedirectUrl, ...

How does the Html Helper, RenderPartial, work? How can I implement a helper that can bring in content from a partial view?

When you use Html.RenderPartial is takes the name of the view you want to render, and renders it's content in that place. I would like to implement something similar. I would like it to take the name of the view you want to render, along with some other variables, and render the content within a container.. For example: public static ...

ASP.NET MVC: Make Session entirely cookie-less (hidden form field)

Hello, is there some kind of standardized way which would allow me to make my ASP.NET MVC web app sessions entirely cookie*less*, but still keep session support through some standardized hidden form field value on every page (e.g. which would get parsed transparently on every request)? P.S. I'm not looking for a URL based /(sessionid)/ ...

losing mvc intellisense

Hi My intellisense doesn't work in aspx or ascx pages running mvc 1.0 When I save or build it does not show the intellisense, but if I do a clean then it works it this a bug or am I missing something ? thanks ...

LINQ, ASP.net mvc and joins

Hi, I am making an application usign MVC and LINQ. I have a controller called home which does this: Dim notes = From x In dal.tbl_notes _ Join y In dal.tbl_note_users On y.user_id Equals x.note_id _ Select x.note, x.datestamp, y.is_owner, y.note_user_id ViewData("notes") = notes Return View(...

C# SQL parent child table select query help

Hello, I have two tables that I want to fetch data from. Lets call them "Parent" and "Children". The "Parent" table has many records in the "Children" table. (One to Many) My problem is I want to find an efficient method for displaying the data the two tables contain to my ASP.NET MVC application. My approach is to select all records ...

jQueryGrid not calling the URL in ASP.Net MVC

I've been trying to implement jQuery's grid function in my Asp.Net MVC app. I'm testing everything out on XP right now, so I've enabled the mvc extension (since I'm using IIS 5) I've run into 2 problems. My jquery grid doesn't seem to be getting called. I referenced all the jquery & grid files using the URL.Content() method Here's my...