Hi,
I'm using ASP.NET MVC and I have a model class which represents a peice of data which is associated to an entity but created by another. For example, given the following ViewModels,
public class User {
public int UserId { get; set; }
public IEnumerable<NewsComment> Comments { get; set; }
}
public class News {
public int ...
Hi All,
Can someone verify the integrity of this chunk of code? I want to decorate the controllers with it so that it will normalize the url to either https and/or www. This is my second rewrite of the code because the first one tossed itself into an infinite redirect, but somehow I still think it's not quite there...
public class Norm...
I have two objects (class, student) in a database with a many to many relationship (using a simple junction table). I've figured out how to correctly add new objects to tables, and now I'd like to delete an object.
I've been trying the following:
// (a classobj with id==1 does exist)
ClassObj cl = (from c in entities.ClassObjs where c....
I'm trying to set up an MVC2 app with Entity Framework Self-Tracking-Entities. My view is a strongly-typed view of the entity type generated by the STE T4 template. Here's my GET:
public ActionResult Edit(int id)
{
var ri = new App1Service.App1Client().GetMyObj(id);
var changeTracking = ri.ChangeTracker.ChangeT...
I need to create a url scheme like this
friend/{userid}/wishlist
where friend is the controller, wishlist is the view, and userid is the id of hte friend whose wishlist you would like to see.
I have setup a route like this
routes.MapRoute(
"FriendWishlist",
"friend/{userid}/wishlist",
new { contr...
It's one of the parameters supplied to the CreateMetadata method (which you override if extending metadata support).
ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes,
Type containerType,
Func<object> modelAccessor, <<--THIS ONE
Type mo...
Perhaps I'm missing something here, but it seems that anything in the object model tree 3 or more levels down, is ignored when using TryUpdateModel.
For example (simplified):
public virtual ActionResult SomeAction(int id, FormCollection form)
{
IValueProvider vpFrom = form.ToValueProvider();
/*
At this stag...
Hi,
I've been reading 'ASP.NET-MVC Tutorials' to learn how to generate data for the 'masterpage' view in an ASP.NET MVC application. It suggests the pattern of using a 'base-controller' and generating the data in its constructor.
My issue is that I wish to store the application data in the application cache rather than the viewdata ...
Hi guys,
I've got a problem with ASP.NET mvc stongly typed helpers.
Here is example of wrong behavior:
<% foreach (var item in Model) { %>
<%: Html.TextboxFor(m => item.Name) %>
<% } %>
will generate following inputs: <input name="item.Name".....
As you see generated name is wrong, because of wrong algorithm of extracting proper...
I'm currently using an attribute based approach to nhibernate session management, which means that the session is open for the duration of the Action method, but is closed once control is passed to the View.
This seems like good practice to me, however I'm running in to problems with lazy loaded collections. (This is complicated by th...
I have the following scenario that is causing me problems around the mapping fragments referring to same Id columns. This is what im trying to achieve not sure its even possible!
Essentially I want to have a common way of accessing content, and as needed a specialisation of blog and article. I have the Contents entity working with the...
Here is my scenario: We would like to have a page listing donors, depending on the user viewing the page we would like to group by the donor's giving level, or just their sort name. The twist that is throwing me is that we would like to group the Anonomous Donors and give a count based on the grouping.
In my controller I have
[Http...
I think this is a pretty common scenario, but I haven't been able to phrase my problem in such a way that I have generated any useful search engine results. I'd like the Index action of my HomeController to return the action from a different controller.
I have come up with a few solutions but have dismissed each for various reasons:
U...
Hi folks,
can I have a route like...
routes.MapRoute(
"Boundaries-Show",
"Boundaries",
new
{
controller = "Boundaries",
action = "Show",
locationType = UrlParameter.Optional
});
Where the action method is...
[HttpGet]
public ActionResult Show(int? aaa, int? bbb, LocationType locati...
Hello, I have a website project in ASP.NET MVC2 and use a Fancybox which loads a contactform in an IFrame. It all works fine.
But... When I debug my project in VS2010, the Action in my Controller got hit 2 times while I expected it to be hit only once.
The Action gets hit by this Javascript code:
$('<iframe id="fancybox-frame" name="f...
Hi there!
In his blog Nicholas announced support for ASP.NET MVC 2.0 Areas. However, I couldn't get it working and from what I see in Autofac sourcecode, areas support is nowhere to be seen. More specifically, RegisterControllers
return builder.RegisterAssemblyTypes(controllerAssemblies)
.Where(t => typeof(IController).IsAssignable...
I am looking for a web based way of showing users tiff, pdf, doc(x), and xls(x) files. This is being required from a business standpoint and I don't have a whole lot of weight/control into the decision being made. The web application will be used by both internal and external customers, not publically available though.
Pricing is not su...
I have a sample application, trying to learn jQuery validation and submit form in this scenerio.
The page has one text box (EnvelopeID per class Envelope). If submit button is clicked and the text box is empty then i want to show an error message. If it is not empty then i want to post ajax request to GetData Action. The action returns...
I'm using castle windsor in asp.net mvc 2, with a separate project for the domain model which contains datacontext (dbml), I've deleted the app.config in the domainmodel project
getting the following error:
Can't create component 'DomainModel.Concrete.ArticleRepository' as it has dependencies to be satisfied.
DomainModel.Concrete.Arti...
I have a class that returns an object type to a variable. The variable Must know what the real type is when operations are performed on it:
public object Data
{
get
{
switch (CriteriaID)
{
case (int)matrix2.enums.NodeTypeEnums.Enums.MultiLineText:
return (s...