asp.net-mvc

ASP.NET MVC Model alternatives

I'm creating an MVC project but reluctant to use ADO.NET Entity Framework for the reason that it does not provide me a layered approach for my application (DAL, BLL). Is this correct? If so, are there alternatives? ...

MVC / EF Query -- A better way?

Objective: Get a list of name|id pairs for a select list from table A where the id does not exist in a filtered collection of Table B records. Constraints: Using MVC 1.0, Entity Framework (no L2S, DataContext, etc.), C# My question is whether there's a smarter way to go about doing this than what I've got working so far--which just s...

how to change the inline style of the page using jquery

I have an inline styles in my page as : <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>:: Inline Style Page ::</title> <style type="text/css"> <!-- body { background: #fff; font: normal 12px Tahoma, Verdana, Arial; color: #636363; } #header { he...

Login controls in an ASP.NET MVC master page

I have an ASP.NET MVC 2 web site in which I'd like to place login controls in the master page. I want any validation error messages to appear in the master page as well. How would I go about doing this? If I do something like this: <% using (Html.BeginForm("LogOn", "Account", FormMethod.Post)) { %> <%= Html.LabelFor(d => d.UserN...

[CSS] adding an ID Number to a CSS Tag

I am inspecting the html at this site: listverse.com I see that they have inserted ID numbers in the List Tags such as <li id="comment-220669"> What is the comment-220669 for. And what are they using it for? If they are using this ID tag to pass information back to the server. How can i do this using c# asp.net mvc? ...

ASP.Net MVC "Magic Strings" - Can they be avoided allways?

Ok take this example below, public ActionResult ViewProfile() { //Load the profile for the currently logged in user if (Membership.GetUser() != null) { //Do some stuff get some data. return View(ReturnViewModel); } return RedirectToActio...

MVC - Datagrid binding without a model

Ok, I'll explain. I need to create a datagrid in MVC on the fly (potentially multiple datagrids on a view) depending on a XML file being read in. The file gets looped through and may contain multiple grids of data, the headers and rows are set in the file. The problem being that my application won't know the content of the XML file befor...

Validate object based on external factors (ie. data store uniqueness)

Description My solution has these projects: DAL = Modified Entity Framework DTO = Data Transfer objects that are able to validate themselves BL = Business Layer Services WEB = presentation Asp.net MVC application DAL, BL and WEB all reference DTO which is great. The process usually executes this way: A web request is made to the W...

what's wrong with these?

I create a strong typed view ,but i can't get the Mode and viewdata and the Html... This is my sample code: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MiniMain.ViewModel.ArticleViewdata>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> ...

Why i can't call the Model and ViewData, and Html in the strong typed page?

I created a new strong typed View ,something like this: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MiniMain.ViewModel.ArticleViewdata>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> <%Model %> </asp:Content> but when I called...

Areas in asp.net mvc, only one work at time

Hello. My folder look like this: (root)/Areas/Admin/Views/.. (root)/Areas/Admin/Controllers/... (root)/Areas/Admin/Routes.cs (root)/Areas/Forum/Views/.. (root)/Areas/Forum/Controllers/... (root)/Areas/Forum/Routes.cs public class Routes : AreaRegistration { public override string AreaName { get { return "Admin"; } ...

How to invoke a action on a link button click in ASP.Net MVC app?

Hi, I want to invoke an action (which is in HomeController) on link button click? The link button is present on a empty View which I have added to Views which is not a stronly typed view? regards, kapil ...

Input builder for a DropDownList with data from DB in mvc contrib

I have something like this public class Person { public Country {get; set;} } public class PersonInput { public ImNotSureWhatShouldIUseHere Country {get; set;} } there is a input builder for Enums in mvc contrib but it's not good for me because i retrieve the data from the DB and i save the Id of the selected element not the valu...

<%= autocompletes to <%@ Assembly= in Visual Studio

Hi, Using Visual Studio 2008 with the asp.net MVC framework. In partial views, if I try typing "<%=" to print out some data from the model, it autocompletes the "<%" to "<%@ Assembly" (tagiing my "=" on the end). Very annoying and I'm nearly sure it didn't used to, but can't think what I could have done to cause it. Any ideas anyone?...

Why is there no Model in ASP.NET MVC?

After reading Steven Sanderson's book Pro ASP.NET MVC I am convinced about the benefits of using ASP.NET MVC over webforms. Since ASP.NET MVC is clearly inspired by Ruby on Rails and the benefits of "Convention over Configuration" it strikes me that the M in MVC is completely missing! In my opinion, the ease of using Rails comes equall...

ASP.Net MVC Application points to localhost instead of application directory

Hi I am deploying an MVC application on IIS on Win7. I have deployed it on localhost/appPortal. appPortal is configured as application rather than virtual directory. Unfortunately the application root in MVC gets mapped to localhost instead of localhost/appPortal. This is breaking all my links to scripts, css, images etc. Can anyone help...

ASP.NET background processing blocks status or UI feedback

I know this question has been asked many times, but my problem is a little different. I have page which lets user download and upload excel file. During downloading excel, it takes approx 2 mins to generate the file. I have added checkpoints which updates the database with status like (started processing, working on header ...etc). I ha...

Get checked values from array

Hello I'm using mvc and I'm trying to loop through a array of checkboxes, but how do I exclude the ones that are "false" in that list? for(int i = 0; i < TimeRange1.Length; i++) { if(TimeRange1[i] == "false" ....??) // dostuff } or is there some better way of doing it? /M ...

How to propose Asp.Net Mvc over other technologies to client?

How to show benefits of adopting asp.net mvc to client? I mean - we as developers can understand benefits of easier implementation of automated testing, better control over rendered html etc., but what would be strongest motives for client to accept usage of asp.net mvc? Maybe there's some more nice looking examples built with asp.net ...

Protecting IDs on a URL in ASP.NET MVC

I'm working on a typical CRUD application in ASP.NET MVC where there will be multiple user accounts and each will have a number of items. When a user is editing an item, they will be doing it on a URL such as /edit/5 where the number represents the ID of the row in the database. I have some concerns about one user simply changing the ...