For those that create ViewModels (for use by typed views) in ASP.NET MVC, do you prefer to fetch the data from a service/repository from within the ViewModel, or the controller classes?
For example, we started by having ViewModels essentially being DTOs and allowing our Controllers to fetch the data (grossly oversimplified example assum...
Hi, I am creating an ActionResult in ASP.Net MVC to serve images. With Session state enabled, IIS will only handle one request at a time from the same user. (This is true not just in MVC.)
Therefore, on a page with multiple images calling back to this Action, only one image request can be handled at a time. It's synchronous.
I'd like ...
Hi all,
I need to do the following:
I have a textbox, which appears in every page of the site, that allows to subscribe to a newsletter. This I've done already and the user is redirected to previous view after subscription.
I'd like to add a javascript alert to the page the user is returned to, something like "Thanks for subscribing"....
Hi Guys,
I want to default value(getter value) to be set for the data property , if the value set by the user does not meet the condition(without private variables).
Here is the code
public class TreeViewModel
{
public a()
{
this.Height = 200;
}
public int Height { get; set ; }
}
If the user sets the value of height less...
Hi all,
Has anyone ever eperienced session's being shared application wide?
My MVC application has the vanilla setup but for some reason, my sessions are being shared.
I didn't really think about it when I could switch between FF and IE and maintain a logged in state but now, I've noticed that I can switch machines too.
My web.confi...
I'm using Kohana's pagination library and it lets you specify the parameter uri_segment at initialization.
When it generates the pages links, they will have that uri_segment you specified, and after that, the page link. Let's say: /some/uri/segments/6 where 6 is the page.
Now, that enforces the page number to be the last uri segment. W...
Hi - I am trying to use the JQGrid plugin and have run into an issue I can't seem to get around. First I'm using the latest version on the grid (3.5.3) in an ASP.NET MVC app. Almost everything is working great - loads my data, edit form fires the correct Controller method. My issue is with the Add record Form. The form displays fine but ...
Hi All,
I really hope you can help me as I am about to just throw my MVC/Entity Framework project in the bin and start a MVC/Linq project.
I am building a forum as a project just to get to know MVC/Entity, and I have 4 tables which are all related.
Forum_Category,
Forum,
Topic,
Reply
so there is a 1 to many on Category_ID between F...
After watching this video, I am wondering if I am using my controllers wrong. What exactly should a controller contain?
For my blog, I have a post controller which has methods:
create
show
list
loadPost
like
dislike
Whereas my post model only has a few access rules, validation rules and relation information. Are there any examples of a...
I am building my very first MVC project and I would like to use scaffold a new view using custom types that exist in a referenced assembly.
Is scaffolding only available for locally declared types?
I add a new view via the "Add View" dialog, I choose to "Create a strongly-typed view" and I pick my class type in the "View data class" d...
I have some pages designed by someone else as simple HTML that I need to dump into my MVC application.
Not surprisingly the images are stored in a local /images directory.
I'd like to be able to serve the images up from the Views directory where the main view pages are.
I'd rather do this than make it its own virtual directory, but I...
Hi there,
I have an application here with a mix of webform and mvc. I specify the routing as below
routes.Add("AspxRoute", new Route("Upload/New", new WebFormRouteHandler<Page>("~/Uploads.aspx")));
routes.MapRoute(
"Default", // Route name
"{controlle...
How do I get the referrer URL in an ASP.NET MVC action? I am trying to redirect back to the page before you called an action.
...
I've been programming for over 15 years and started with .NET 5 years ago. We built our framework for windows data-oriented apps and it is a quite stable.
At this point, we are considering to make a new platform. But, I am a little bit confused with all these new technologies. We considered CAB and SmartClient technologies but there are...
I am looking into using Doctrine2 with my Zend Framework setup. I really like the datamapper pattern, mainly because it seperates my domain models with my database.
My question is what is the best practice for using Doctrine and DQL with my controllers?
controllers uses Doctrine
DQL/EntityManager directly for
saving/loading my domain ...
Encountered such problem: Ive created a new blank project of ASP.NET MVC site. Then Im trying to add a reference to jquery-1.3.2.js from Masterpage head. But in this case, page doesnt loading to browser. Ive bee trying and src="<%=Url.Content ("~/Scripts/jquery-1.3.2.js") %>", all the same. Then I moved the script reference to the end o...
I know that I am for responsible for this in the code, but in a object-oriented and MVC sense, who should really load the model. I have a model for representing RSS feeds that is being loaded from a url. The model is really thin and the controller manages downloading and parsing of the XML and then passes it on to the model. Is it better...
I would like to know when (which event/function) the class System.Web.Mvc.ViewPage runs when it reads the @Page directive of the view.
In particular, I would like to programmaticly interpret the values of the @Page directive, override them, then have the cycle continue.
...
I am now doing the UI from fresh so I want to make it fully test.
Could anyone suggest the correct way to do this and where should be the good place to start?
such as Concept, Framework.
(I already know some concept of testing)
...
Hi Guys
This has probably come before and is probably very subjective. I have been tols to avoid using ViewData and use a FromViewModel class to pass informaiton to the view istead.
Are there any major advantages of this approach?
Thanks
Davy
...