Hello. I'm diving into ASP.NET MVC 2 and I'm walking through a tutorial and I'm getting an error related to a template method in my unit tests. The erroneous code is...
var displayedProducts = (IList<Product>)result.ViewData.Model;
displayedProducts.Count.ShouldEqual(2);
and the method definition for ShouldEqual is...
public static...
I'm using ASP.NET MVC and have a model that has System.Data.Linq.Binary property. The property represents a picture that has been stored in the database as an image column.
I am able to use the picture in my pages by setting up a separate controller action and using Response.OutputStream.Write to dump the Binary object and then setting...
I'm starting with MVC 2 in Visual Studio 2010. The thing is I'm working with a MasterPage where I'm rendering an action which returns a UserControl:
Everything works well, I mean the user control has a lot of other labels and it's rendering other properties... So the problem has nothing to do with anything apart the img tag and the src a...
Hello!
Has anyone tried to make T4MVC work in MonoDevelop?
Out of the box, I get this error: Could not resolve include file 'T4MVC.settings.t4'.
When I include the full path in the include statement, it makes MonoDevelop crash completely.
Thanks for any info!
Marc Lacoursiere
...
Hi I'm building my first MVC 2 app and I'm really confused by all the examples I'm reading. I am also using the Telerik MVC kit for their Grid, and other such controls.
I've read many tutorials and watched videos but I can't quite grasp the pattern of where to place javascript and how to wrap blocks of code in the appropriate tags. For ...
I have an existing asp.net mvc website that uses basic forms authentication. The site has a login page that posts back to a login action, which logs the user in via FormsAuthentication.SetAuthCookie(). I am looking to add an api to the site, as an mvc2 area, where users would be authenticated based on a token passed as an http header. ...
I want to add a simple route to my webapp, but it just doesn't work and i don't know why
code in global.asax.cs:
routes.MapRoute(
"BrowseGenre",
"{controller}/{action}/{genre}",
new {controller = "Store", action = "Browse", genre = UrlParameter.Optional}
);
code in StoreController.cs:
...
at the moment I have this:
in the ViewModel:
[MyCustom(Foo = 23)]
public int CountryId { get; set; }
in the Editor template:
<%= Html.TextBox("", Model) %>
how can I get the value (Foo=23) from my custom attribute (MyCustom) into the editor template ?
...
I have a PartialView strongly typed to a view model
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<VATRateManager_MVC.Models.ViewModels.RateControlEditViewModel>" %>
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascri...
Hi I am getting data in ViewData on my view in my asp.net MVC application. I want to change the value of control dynamically. so I have write the Jquery for this. But How to get data from ViewData and and update it dynamically?
how can i change the View Data data from j query and assign it to control ?
...
how to access the Model Classes in Jquery in asp.net mvc ?
...
Hi,
I have some problems with validation using Data Annotations in ASP.NET MVC 2. For example, I have Address class:
public class Address
{
public long Id { get; set; }
[Required]
public string City { get; set; }
[Required]
public string PostalCode { get; set; }
[Required]
public string Street { get; set;...
I wanted to create an editor template for a field type that is represented as a dropdownlist. In the definition of the editor template I would like to populate the DropDownList using a call to an action on the controller returning the results as JSON - Any ideas how to do this?
E.g something like:
<%@ Control Language="C#" Inherits="S...
We currently have a WinForms application that we want to slowly migrate to a web application.
One screen is a time sheet entry system that uses DataWindow and is very slow and buggy.
Anyway, the time sheet screen has five sections that are saved in real time. A finished time sheet needs 2-5 of these sections.
Currently, the system run...
I have written a custom forms authentication module and when I add it to the web.config of my MVC2 application and run under IIS7.5 I get the HTTP 403.14 error. If I try to navigate to any of the routed Urls then I simply get a 404 error. The annoying thing is that I did all the testing using Cassini with no problems at all. I have appli...
I am generating pdf using itexsharp.
I am creating MemoryStream, then when i am trying t write MemoryStream bytes in to response but no luck. When i am executing this code in my controller the pdf not coming in response. Memory stream is populaitng correctly i can see this in debugger, but for some reason this number of butes not comin...
If you have text coming from a database such as:
"New Apple TV Offers 8 GB of Internal Storage, 256 MB RAM http://t.co/fQ7rquF"
Is there a helper method that takes that text and wraps the web address as a anchor tag?
...
I have an input form that is bound to a model. The model has a TimeSpan property, but it only gets the value correctly if I enter the time as hh:mm or hh:mm:ss. What I want is for it to capture the value even if it's written as hhmm or hh.mm or hh.mm.ss or ... I want many different formats to be parsed correctly. Is this possible?
Thank...
I have tried to use http://mvcsitemap.codeplex.com/ but i can't get it to work with an hierarchical structure from the database... with that said, does anyone know of any other site map provider or can use?
...
I'm writing a small little utility MVC app and I need to have the ability to execute ad-hoc queries against my one-table SQL Compact 4.0 .sdf file for management (Web Matrix isn't working right for development, and it won't be available on the PC this will ultimately be running on). Using Entity Framework code-first, everything is worki...