I have in the controller a custom DataView object that comprises 2 lists. I populate them and than pass the DataView object as model for my view. In view when displaying the data I am checking for null reference. I wonder how to write unit tests to ensure that the programmer did not forget to check for null reference in the view. I would...
Hello
I'm having problems with binding values from a view to an object. Somehow the object gets all values set to null then.
In my viewmodel I have:
public class UserAdminEditViewModel
{
public User User { get; set; }
public IEnumerable<Usergroup> Usergroups { get; set; }
public IEnumerable<User> Users { get; set; }
...
I'm trying to construct the flexible URL routing.
So the url like
en-US/ctrl/act/1/2
should do the same as
ctrl/act/1/2
and set the culture to en-US.
Now I have achieved that by defining two routes as following:
routes.MapRoute(
"Ctrl",
"ctrl/{action}/{group}/{page}",
new { controller = "Home", action = "Index", grou...
2 part question:
1. How does ASP.NET MVC deal / store || ignore malformed headers??
- e.g. if a proxy or security app tweaking:
Accept-Encoding: gzip,deflate
to be -> X-cept-EncodXng: gzip,deflate
As when this happens, I am currently unable to respond optimally – which leads to part 2:
2. Are there any stand...
Hello.
I'm developing a little site using ASP.NET MVC, MySQL and NHibernate.
I have a Contact class:
[ModelBinder(typeof(CondicaoBinder))]
public class Contact {
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual int Age { get; set; }
}
And a Model Binder:
public class Contac...
Hi!
I'm using MVC ScriptManager to Compress and concatenate all my .js files. It works very well, except that if a *.js has a special character such as "á, à" it turns to "Ã!".
I'm trying to change the source code but with no success so far.
Does anyone have an idea what this could be?
Thanks!!
...
I just got a new development box and am having issues getting my MVC project up and running. My old box had Server 2003 and IIS6. I was able to get my MVC apps working on this box after setting up the wild card mapping as mentioned here. My new box is running Vista Business and IIS7. When I copied my app over and tried to run it, I ge...
hi i am trying to create a URL that looks like this:
black/granite/worktops
where the black and granite will change so i have tried to create my own routes in global.asax.cs like so:
routes.MapRoute("Kitchen", "kitchen/[color]/[surface]/[type]",
new {controller = "kitchen", action = "surface"});
changing the...
I have a situation where I want to render the content from a different controller & action.
I do not want to redirect the user to a different URL, I just want to wire up the controller, pass it the info it needs, and have it return the correct view. I want it to think that it was supposed to be there, in that particular url where its ...
As a matter of best practice in MVC, where should the logic go that deals with things such as password hashing/salting or data formatting before it gets sent to the database? I've read that the repository should only be used for logic that deals with data access. Is this something that belongs in a service layer? The controller? Does it ...
Imagine you've got n pages, each of which approximately shares the same sort of model but that model has to be in a particular state before you can access certain pages.
So if the user types in a URL to take them to page m, but this page is not accessible at the moment, the controller adds an error message to a collection of errors in T...
We are starting off a new project with sitecore as our CMS. I was thinking of using Sitecore as the Content Authoring Tool and use ASP.net MVC as in the Content delivery(CDA) Side along with Sitecore. Would love to hear your ideas and thoughts on this.
Have anybody tried this?
Is sitecore and MVC competing or Complementing technologies...
Hi
I have an idea for a website which i would like to run with. My background has always been in the microsoft products, originally coming up from a VB6/ASP to C# and ASP.Net webforms. I love the new asp.net MVC architecture but am worried if my site takes off and i have to scale it, i will be stuck with exhorbitant hosting fees.
Im co...
One of the new features in ASP.NET MVC 2 Preview 1 is support for the concept of Editor Templates and Display Templates which allow you to pre-define how a given object will be rendered for display or editing with a simple HTML helper call:
<%=Html.EditorFor(customer => customer) %>
<%=Html.DisplayFor(customer => customer) %>
This is ...
Most of our projects are short term and of a promotional nature. As a result, our clients often want to put up some sort of "end of program" or "expired" page when the promotion is over. How do I do a blanket redirect of all controller actions to one specific controller action without modifying each controller and its methods? Is this ev...
Hi all,
I'm not sure if you're familiar with the NerdDinner application. It adds a method GetRuleViolations() and a property IsValid to the Dinner object. When the object is saved, it checks whether the object is valid. If it isn't, it throws an exception. In the controller that exception is caught, the ViewData's ModelState is filled w...
In this code in an Edit view, the correct vendor name text appears but it is not validated when I blank its textbox and push Save. The Vendor is a property of the Order model, and VendorName is a property in the Vendor model. They relate referentially. My form does not all input into a single table, but on satellite tables as well.
<%= ...
Hello,
I'm not sure if it is viable to use ASP.NET MVC 2 Preview 1 already in a production system? I would like to, because it introduces several much-needed functionalities which are quirky in MVC 1.
Unfortunately I didn't find anything about that topic or roadmap information in ScottGu's release post from 7/31. Is MVC2P1 already pre...
How can I check latency between server and client using asp.net. I would like to ping the server from the client and get back the results. Is this possible?
I can ping the ip address of the client but obvisouly this doesn't work for numereous reasons. For example on speedtest.net they check latency and report back milliseconds I woul...
I am trying to use the Unity container to make it easier to unit test my controllers. My controller uses a constructor that accepts an interface to a Repository. In the global.asax file, I instantiate a UnityContainerFactory and register it with the MVC framework and then register the repository and its implementation. I added the [Depen...