Questions tagged "asp.net-mvc-3" (page No.1)

Automapper - How to map with dependency on current Session object

I am using Automapper within an ASP.Net MVC application to map DTO's to ViewModel objects. in one of my mappings I need access to an object stored in the Session object. public override void OnAuthorization(AuthorizationContext filterContext) { ... SecurityToken token = SecurityTokenFactory.CreateSecurityToken(userNode); ...

Mouse resize table column

In windows applications we often see tabular data that is visible in a single row. Columns have some max width and the rest of the text is truncated. Said text can be made visible with a click and drag of the mouse on said column. Can this behavior be ...

implementing-drag-n-drop-using-jquery

I've got an MVC 3 application with a requirement for the Sysytem Admin to be able to generate an ordered list of device attributes from a master list of attributes and save it as a specified configuration. I've looked at the question and answers for the following - Implementing Drag ...

MvcSiteMapProvider Sub menu within page

I have a web site using MvcSiteMapProvider for the main navigation. I have run into a scenario that I'm unable to figure out. My site has the following navigation: The site map looks like: <?xml version="1.0" encoding="utf-8" ?> <mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0" enableLocalization="true"> <mvcSiteMapNode title="Look Up" controller="Lookup" action="Index"> <mvcSiteMapNode ...

MVC 3 EF retrieve Many to One from model

I'm creating a page that will display 6 blogs that were created in the passed 7 days. The blog contains an image and multiple comments Here is the Blog model public class Blog { public int BlogID { get; set; } public int likes { get; set; ...

Managing NHibernate Session in an Onion Architecture

I'm trying to set NHibernate to handle my sessions per web request. I have a project that initializes my Session when any of my repositories are used. I would like to know the best way to manage my session per each web request. Because my architecture is decoupled, I would ...

master detail report mv3 razor entity framework

So i have entities for Client.HealthDepartments[0].HDLocationID, i need an master detail report the shows every HDLocation(grouped by ID) and under each of those a list of clients that have that HDLocationID in their HealthDepartments collection in the client object. It doesnt matter if it uses a webgrid or a HTML ...

MVC3 how to get innerHtml from the return sting of @Html.ValidationMessageFor<> method?

I want to show the validation message summary in the tool tip of an html box. Something like this, @Html.TextBoxFor(m => m.Contract.PrimaryContact.FirstName, new { @class = "quarter", title = @Html.ValidationMessageFor(m => m.Contract.PrimaryContact.FirstName) }) How can I do it? As of now am seeing the entire html mark up of the validation message ...

How to search a MSSQL database for byte[]/varbinary using C# and MVC3

For a recent MVC3 project I ended up storing files in an MSSQL database as byte[] (MVC3 turns this into a varbinary(max) column). Once files are committed to the database, they will NEVER change. Now im trying to be real clever and avoid storing the same file multiple times even if ...

Is it possible to use ActionLink and data-role same time?

I wanted to change ActionLink like: @Html.ActionLink("Create New", "Create", null, new { @data-role = "button" }) But it doesn't work. Is it possible to assign data-role into ActionLink? ...

MVC Membership & Profile Strategy

Bear in mind, I have researched this and have found several articles, however, they are mostly old (like from 2008) so I am wanting more recent information pertaining to the latest version(s) of ASP.NET MVC. I am using the Membership built-in thing to provide user registration, login and roles. I want to ...

MVC3 Custom Validation error doesn't display when using ViewModel

MVC3, project using jquery-1.7.2.min.js, modernizr-2.5.3.js, jquery-ui-1.8.22.custom.min.js (generated by jQuery.com for the Accordion plugin), jquery.validate.min.js, jquery.validate.unobtrusive.min.js I have validation working in my project for both dataannotations in the View and for ModelState.AddModelError in the Controller so I know I have all the validation code configured properly. But with custom validation an error ...

Calling an Action in MVC when redirected from a partial view

I'm having this issue in which I have a log in screen and a register screen in different cshtml files, but the register view is called as a @Html.Partial. The code in the log in screen is as follows: <div class="panelLogIn left @if ...

How to keep controllers small in ASP.NET MVC?

I have a pretty well designed architecture where controllers go to services which access repositories which communicate with the database. As such, logic in controllers is kept at a minimum, but I still have very subtle pieces of code that perform some tasks like validate the model arrange the action method arguments invoke some ...

Part of the code is non-reachable after using c# await

I'm writing the video converting tool for one web site. Logic is next User upload the file System conver it for user (of course user should not wait while converting) I have a code: public async void AddVideo(HotelVideosViewModel model) { ...

Html.Raw(Json.Encode and Internet Explorer 9

I use Html.Raw(Json.Encode in my Javascript to grab the contents of the ViewModel property passed to the View in my MVC 3 asp.net (razor) application as follows: var state = @(Html.Raw(Json.Encode(Model.State))); State is defined in my Model as such public class IndexViewModel { ...

JSON.net Deserialise Error - JSON string is valid

I hate to add to the 5,000+ JSON.NET deserialisation errors, but can anyone see anything that might be causing a problem in the following JSON below? Both JSONLint and JSONViewer state that the string is valid, indeed it has already been serialised by JSON.NET without any ...

ASP.NET C# MVC - Capturing value of item in foreach & passing to modal

This may end up being a much simpler problem than I'm making it out to be, but here goes... I have a BookManager class and a Book class. BookManager has many Books - this is setup through EntityFramework using CodeFirst. In the Details page of BookManager, I'm using a foreach statement ...

« Previous12345678910 ... 12671268Next »Show All