asp.net-mvc-2

.Net MVC Ajax and Scriptmanager conflict

Hello all, We have a simple ajax link (Ajax.ActionLink(...)) that has been working fine. Recently, another developer added some ajax-ey code to the same page that uses an asp scriptmanager ... now suddenly the first ajax link no longer works. More specifically we get the error : "sys.mvc.asynchyperlink' is null or not an object". Below ...

What is the best way in ASP.MVC2 to choose an image to display in the controller

I am playing around with an ASP.MVC site, I want one of three images to be displayed depending on the value of an enum in the strongly typed model I have. I could use an IF/Case statement in the view but it should be the responsibility of the controller I feel, what's the best way to implement this? ...

ASP.NET MVC 2 : Having trouble with creating a Master-Detail View

Hi everyone ! I'm having trouble right now with the creation of a Master-Detail page in an ASP.NET MVC 2 project at the moment. This project uses Entity Framework OR/M for table mapping. I'm using a custom CategoryModel which is passing another list of objects. I've simplified the Model for presentation purposes : public class Cat...

How to add custom text to the footer of an MVC telerik grid

I am using the telerik MVC grid extension in my MVC2 application, and I would like to add a custom piece of text (a record count) in the footer. I don't want to use paging in this particular case. Is this supported? ...

Why isn't MVC binding my nested collection?

Hello SO, If got a couple of linqTOsql objects that I am trying to edit through a form. First, there's the Stream class: [Table] public class Stream { [HiddenInput(DisplayValue = false)] [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)] public long StreamID { get; set; } /*other propert...

Implementing Navigation Properties in Entity Framework

Hey folks, I've been learning MVC 2 and I have pretty much everything understood except for the model part of things, I understand what the model is but actually implementing it has me confused. Here's my situation, I have my DB which has 3 tables; Ideas - table of ideas Tags - table of tags IdeaTag - link table connecting the above 2 ...

Jquery Validator: Validate form without submiting

Hi I want to validate a form using a button, but this button call a .ajax function to submit the form. How can i do this? I've searching. I had one way but i wonder if there's an easy way. The way I accomplished this is: Javascript jQuery(document).ready(function () { $(ACCION).validate({ rules: { ...

What is the difference between [AcceptVerbs(HttpVerbs.Post)] and [HttpPost]?

I can decorate an action either with the [AcceptVerbs(HttpVerbs.Post)]/[AcceptVerbs(HttpVerbs.Get)] [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(string title) { // Do Something... } or with the [HttpPost]/[HttpGet] attributes [HttpPost] public ActionResult Create(string title) { // Do Something... } Are they di...

ASP.NET MVC 2 Automapper Placement

I am using Automapper to convert between my EF4 Models and my ViewModels. Automapper needs map relationships declared and I find myself copy/pasting them inside every controller's constructor. Mapper.CreateMap<CoolObject, CoolObjectViewModel>(); Where can I place the mapping declarations so they will only be called once and not every ...

Conditionally load jquery throbber plugin

I have the code below that shows a throbber and makes a getJSON call to an MVC action when the user changes an entry in a select. This all works great except there is a default -- select -- element in the list for which I don't want the getJSON to run. However, I can't work out how to apply conditional logic to hooking this event. The...

ASP.NET MVC : Sending information to make a RedirectToAction

I need to send data before making a "RedirectToAction" to the new view, and do not want the data being sent by "GET". The only thing I can think of is to keep this information in session before redirecting to the new view, but I prefer to do otherwise. Thanks. Edit width example public class AccountController : Controller { publi...

ViewModel is not binding from the POST form when passed into a method as a parameter

I'm new to asp.net mvc, but I've thoroughly searched on this topic everywhere. I've a ViewModel class named PictureViewModel which is the class an EditorTemplate view inherits from: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <div class="editor-label"><%: Html.LabelFor(m=>m.Name) %></div> <div class="edi...

ASP.NET Storing Contextual Data During A Request

I am writing an ASP.NET application that initializes some contextual data based on stuff sent through the Request object. How should I be storing this so that it is only visible to objects dealing with the request? Essentially I have an HttpModule that looks at the request, and does something based on the incoming data: public void OnB...

stopping ZmEu attacks with ASP.NET MVC

Hello, recently my elmah exception logs are full of attempts from people using thus dam ZmEu security software against my server for those thinking “what the hell is ZmEu?” here is an explanation... “ZmEu appears to be a security tool used for discovering security holes in in version 2.x.x of PHPMyAdmin, a web based MySQL database man...

Is there a strongly typed RedirectToAction in ASP.NET MVC 2 ?

I wish to do something like this: return RedirectToAction<SomeController>(c => Index(someparameter)); How to do this ? Thanks, D. ...

ASP.NET MVC2 application calling WCF duplex service

Hello All, I have an MVC2 application. Basically, in my Bill view, I want a user to click "Request Bill" and it calls the WCF service. The service then returns back a callback with the amount owed. I am having 2 issues. The duplex method callback from the client does not execute or does not get called. This happens intermithtently. So...

Newbie question about mocking and moq framework

I've been using Moq framework in c# for mocking in unit tests however there is one thing I dont complete understand yet. I have this line of code var feedParserMock = new Mock<ApplicationServices.IFeedParser>(); feedParserMock.Setup(y => y.ParseFeed(csv)).Returns(items).Verifiable(); The second line does it mean it will only return th...

Should jQueryUI apply styles automatically

I've created a theme and applied it to my ASP.NET MVC site. However, the elements on the page aren't picking up the styles automatically. If I do the following for a specific element they get applied appropriately: $("input[type=button]").button(); $("input[type=submit]").button(); Am I right in thinking I need to do this for all th...

How to add meta tags on a master page for ASP.Net MVC 2

I have a master page currently with the below for the title: <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> I've now realised I have to put meta tags in, would that be best done like so: <asp:ContentPlaceHolder ID="TitleContent" runat="server"> <title>Title</title> <meta name="Description" content=" ... ad...

ASP.NET MVC 2 - simple increment value in database by submit in view

I'm guessing is very simple, but I'm learning MVC 2 right now and I'm stuck. I've got strongly typed view with some fields and buttons which should change something in database by click on them. So it is code <% using (Html.BeginForm("UpVote", "Home",FormMethod.Post,new { linkId = link.LinkID })) {%> <input type="submit" val...