asp.net-mvc

Uploading an image in ASP.NET MVC using EDM

I am new to using ASP.NET MVC and I've been having some difficulties with it. I created my model using the Entity Data Model just for the record. My problem is that I'm trying to insert an image into my MS SQL 2008 server using my new ASP.NET page. The image is a part of the information that I need to store about Employees in my databas...

What is the ASP.NET MVC equivalent of displaying a Label conditionally?

I'm currently porting an ASP.NET WebForms application to ASP.NET MVC. In one of the pages there is an ASP.NET Label control which is displayed conditionally based on a variable in the codebehind. So, something to the effect of <asp:Label runat="server" Visible="<%# ShowLabel%>"> ... </asp:Label> Where ShowLabel is a Boolean value in...

ASP.NET MVC - Current Folder Of View

Does anyone know how to get the current folder of the view being called? I'm using AreasLib as well, so I need to get it dynamically without prefixing paths. So for example, if I do http://localhost/myarea/mycontroller/myaction it will give me the path of Project/Areas/myarea/Views/mysubsystem. So yeah, it needs to be the folder that ...

How to get model binder to leave null strings as null?

My Sql Server database has some nullable nvarchar fields, and no nvarchar fields containing empty strings. I want to keep it this way, but the default MVC model binder seems to turn null strings into empty strings. When a controller retrieves a null nvarchar database field, the null field turns into null string inside the controller, an...

Custom HtmlHelper extension method not available in View?

I have translated Jeremiah Clark's CheckBoxList Helper for MVC into my VB.Net project but when I try to use the method in my view I get the error 'CheckBoxList' is not a member of 'System.Web.Mvc.HtmlHelper(Of Attenda.Stargate.Web.UserRolesViewModel)'. Can anyone tell me where I have gone wrong? Helper module: Imports System.Runtime...

Is there a paging solution for ASP.NET MVC that does paging in the database?

Most of the ASP.NET MVC paging solutions I have found by googling look like they get all rows from a database table in the form of a IEnumerable collection, perform some paging conversion on the IEnumerable collection, and then return the results to the view. I want to be able to page on the DB side but still have some paging class to d...

Sending custom HTTP error information to Flash, JavaScript, etc.

I'm developing a REST API at the moment, and one of the core features of this is that is uses a variety of HTTP status codes to return status/error information, some of which may be extended information (e.g. if an item is not found, some other similar items) which will be in the response body. This is fine until you get to 'crippled' c...

Getting 404 When Requesting MVC Page within Classic ASP Application

Current Application Server Configuration: IIS 6.0 Windows 2003 Server Standard Edition SP2 .NET Framework 3.5 SP1 Current Application Architecture Classic ASP 3.0, referenced within HTML Frames A few ASP.NET Web Forms System.Web.Mvc.dll copied to Web Application bin folder To test the feasibility of gradually incorporating ASP.NE...

Safe Web Text Formatting

I am building a web application that will need to allow users to save formatted text to a database. Basically they just need to be able to change font color, font background color, font size, bold, italics, and underline. I would like to use something that I can just attach to a text area to make a formatting bar show up. It would be n...

Web App Performance Problem

I have a website that is hanging every 5 or 10 requests. When it works, it works fast, but if you leave the browser sit for a couple minutes and then click a link, it just hangs without responding. The user has to push refresh a few times in the browser and then it runs fast again. I'm running .NET 3.5, ASP.NET MVC 1.0 on IIS 7.0 (Win...

How to unit-test an MVC controller action which depends on authentification in c#?

I'd like to write (in c#) a unit-test for an MVC controller action which might return one view or the other, depending on whether the request is authenticated. How can this be done? Thanks in advance. ...

.NET RIA Services with MVC Style Repositories?

I have a Solution with several projects in it, including two asp.net mvc projects that share a Repositories and Models that live in a external assembly (also in the same solution). Essentially... Core/ -Repositories -Models Domestic.Web/ -Basic MVC Site, references the core project International.Web/ -Basic MVC Site, references the ...

Using WebParts in an MVC application

I'm looking for information on now to use a web part in ASP.NET MVC. I've done this in WebForms, but the MVC model is very different. Has anyone got any good links to good tutorials on getting it working? Are there any issues to be wary off? etc.? Thanks ...

How to get html returned from ActionResult in Controller

I am trying to implement a feature similar to the Related Questions on StackOverflow, I am doing this in MVC. $().ready(function() { var s = $("#Summary").val(); $("#Summary").blur(function() { QuestionSuggestions(s); }); }); function GetPastIssues(title) { $(document).ready(function() { $.ajax({ type: "POST", url: "/Issue/G...

Multiple master pages in a single application

Is it a good design to have multiple masterpages in an application. I am building a website using Asp.net MVC with different type of users like, admin, employee, general user, etc And every user once logged in have different type of controls on the website, so I was planning to use different master page for each user. ...

Firing order for multiple $(document).ready(function(){... in ASP.NET MVC page

I have a master page Default.master which contains a script tag to load Master.js. <script src="<%= Url.Content("~/Scripts/Shared/Master.js") %>" type="text/javascript"> </script> <asp:ContentPlaceHolder ID="HeadContent" runat="server" /> Then I have a content page Upload.aspx based upon Default.master which...

ASP.net MVC custom route handler/constraint

I need to implement an MVC site with urls per below: category1/product/1/wiki category1/product/2/wiki category1/sub-category2/product/3/wiki category1/sub-category2/sub-category3/product/4/wiki etc. etc. where the matching criteria is that the url ends with "wiki". Unfortunately the below catch-all works only in the last part of th...

How to use two instances of the same .ascx in the same page in ASP.NET MVC ?

I have two instances of an Address.ascx control in an ASP.NET MVC page. <h1>Shipping Address</h1> <% Html.RenderPartial("Controls/AddressControl"); %> <h1>Billing Address</h1> <% Html.RenderPartial("Controls/AddressControl"); %> Of course, with the code exactly like this I'll end up with the same IDs for each field in the...

Should View Models in ASP.Net MVC be all strings?

I've got to the point (unintentionally) that I feel in some parts I'm doing too much within the view (.aspx) itself, too much formatting, concatenation, in one place a little regex replace. I was starting to work on a new part and trying to improve my approach.. Then it hit me why don't I just make all my View Models (in /Models/ in .We...

Why to move to Asp.NET MVC - why not to move

Simple as it is : Why to move to Asp.NET MVC & why not to move ( if there is any reason ) ? Added Is it a necessity to move ? Can we say the future belongs to asp.net mvc ? How many years do you think it can stays on top ? ...