I am using subsonic repository pattern(2.1) for asp.net mvc application.In my application,there are many repositories like categoryRepository,Blogrepository etc.Inside each of this repository i am calling subsonic's DB.Select().From()...ExecuteReader() and then loading domain objects from those reader.
In the controller action i make m...
I have edited and simplified this question a lot.
If I have this method on my HomeController:
public ActionResult Strangeness( int id )
{
StrangenessClass strangeness = null;
if( id == 1 )
{
strangeness = new StrangenessClass() { Name="Strangeness", Desc="Really weird behavior" };
}
...
I would like to edit the ASP.NET MVC templates for Visual Studio so that any new action or controller created has a specific piece of code within it by default.
For instance, I'd like to replace the generated:
public ActionResult MyAction()
{
return View();
}
with a specific coding standard we prefer to use within...
Hi,
I am working on a mvc project, and having problem with json.
i have created a demo project with list of colors
public JsonResult GetResult()
{
List<string> strList = new List<string>();
strList.Add("white");
strList.Add("blue");
strList.Add("black");
strList.Add("red");
strLi...
How will i access the querystring value in a view
...
I have HtmlHelper in ASP.NET MVC 1.
Now I wont to migrate to ASP.NET MVC 2, but this helper don't work =(
public static string Image(this HtmlHelper helper, string url, string alt)
{
return string.Format("<img src=\"{0}\" alt=\"{1}\" />", url, alt);
}
public static string ImageLink<T>(this HtmlHelper helper, Expression<Action<T>...
I am making a number of distinct controllers, one relating to each stored procedure in a database. These are only used to read data and making them available in JSON format for javascripts.
My code so far looks like this, and I'm wondering if I have missed any opportunities to re-use code, maybe make some help classes. I have way too l...
I have a page with a select list (ASP.NET MVC Page)
The select list and onchange event specified like this:
<%=Html.DropDownList("CompanyID", Model.CompanySelectList, "(select company)", new { @class = "data-entry-field", @onchange = "companySelectListChanged()" })%>
The companySelectListChanged function is getting called twice?
I a...
Hello Everyone,
I would like to achieve something very similar to this question, with some enhancements.
There is an ASP.NET MVC web application.
I have a tree of entities.
For example, a Page class which has a property called Children, which is of type IList<Page>. (An instance of the Page class corresponds to a row in a database.)
...
I am experiencing some confusion with jquery.validate.js
First of all, what is MicrosoftMvcJqueryValidation.js. It is referenced in snippets on the web but appears to have dissapeared from the RTM MVC2 and is now in futures. Do I need it?
The reason I'm asking is that I'm trying to use the validator with MVC and I can't get it to work....
Recently, I've been very interested in APIs, specifically in how to create them. For the purpose of this question, let's say that I have created an ASP.NET MVC site that has some data on it; I want to create an API for this site.
I have multiple questions about this:
What type of API should I create? I know that REST and oData APIs ar...
Hi,
I have a tricky problem and I'm not sure where in the view rendering process to attempt this. I am building a simple blog/CMS in MVC and I would like to inject a some html (preferably a partial view) into the page if the user is logged in as an admin (and therefore has edit privileges).
I obviously could add render partials to mast...
I'm using a controller to call a stored procedure that requires 12 parameters. This works perfectly in debug mode locally (working against a remote database), but not when I publish it to my IIS 7 server. It complains about parameter #7, claiming it's not supplied with the URL.
The URL call looks like this;
http://localhost:50160/GetPl...
Hello all,
I've got a scenario where we have a customer who has a linux hosted php app (joomla) that they wish to integrate with some back-end asp.net mvc functionality that was created for a 'sister' site. Basically, the mvc site has prices and stock availability methods which (in the sister site) populates dropdown lists and other 'or...
i see the new feature of areas in asp.net-mvc 2. it got me thinking. why would i need this? i did some reading on the use cases and it came down to a specific point to me around how big and how broad scope should my controllers should be?
should i try to have many little controllers? one big controller?
how do people determine the ...
hi,i'm building a simple school portal, i have stucked at uploading an image into my application, i.e a user should upload school image to my server, i have directory for images as ./Content/Images -- all uploading images should be uploaded to this directory. i have following code
input type="file" id="SchoolImageUrl" name="SchoolImag...
I am an experienced asp.net web forms developer using c# but i have never used asp.net MVC. As I am just starting out with mvc i would like to start with mvc 2.
I am looking for a good intro/tutorial to help me understand the basics. I am aware of the Nerd Dinner but that is based around MVC 1.
What would you guys recomend for me to...
setting type to hashed seems to not allow enablePasswordRetrieval. what if a user forgot their password?
...
I frequently use AutoMapper to map Model (Domain) objects to ViewModel objects, which are then consumed by my Views, in a Model/View/View-Model pattern.
This involves many 'Mapper.CreateMap' statements, which all must be executed, but must only be executed once in the lifecycle of the application.
Technically, then, I should keep them ...
After googling for a while I'm still drawing a blank here. I'm trying to use a ViewModel to pull and provide a dictionary to a drop down list inside a strongly typed View:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="EveNotebook.ViewModels.CorporationJoinViewModel" %>
...
<%: Html.DropDownLis...