I have a MVC page which allows creation and editing of a subcontract. When the user has to select a company for the subcontract, I would like for them to have the option to create a new company. I've made a jQuery pop-up with the company fields, but I don't know how to then save this information to the company table. I would also like...
i have an action that return a file content. i added:
Response.AddHeader("Content-Disposition", "attactment; filename:\"" + survey.File + "\"");
so that the image would be opened in another tab/page, gets opened in the current tab/page.
whats wrong with the header?
...
I went to http://www.asp.net/mvc and the web installer offered me the option to install MVC 2, but not MVC 1.
I thought MVC 2 was still in beta? Either way, I need to write an MVC 1 app. In visual studio, my only choice is either ASP.NET Web Application or ASP.NET MVC 2 Web Application.
Can anyone advise?
...
I am using ASP.NET MVC 2, and am using a view-model per view approach. I am also using Automapper to map properties from my domain-model to the view-model.
Take this example view-model (with Required data annotation attributes for validation purposes):
public class BlogPost_ViewModel
{
public int Id { get; set; }
[Required]
...
I'm using Data Annotations with ASP.NET MVC 2 as demonstrated in this post:
http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx
Everything works fine when creating / updating an entity where all required property values are specified in the form and valid.
However, what if I only want to update some o...
Is there a way to restrict what I see when I select the View Data Class drop down, to just the models in my Application? It seems that if I have any references in my app, that drop down gets really noisy.
...
I am returning File result from action triggered by the form post event.
I can't get download dialog. Instead, if I use:
return File(Encoding.UTF8.GetBytes(reportPath), "text/plain", "Report.csv");
I get path to the file upon ajax execution in the target div.
When I use
return File(reportPath, "text/plain", "Report.csv");
I get c...
I have my views render to route requests like /controller/action (for instance, /Page/Create), so pretty classic.
I am creating a form where view will be loaded through AJAX request with jQuery get(), so essentially I need my Views or to be precise, my controller actions, to return plain HTML string when an AJAX request is made to the r...
i have 2 urls on one page: http://host/home/list and http://host/home/list/1. if i click on second url then first url renders with param 1, so url1 equals ulr2 (url1 = http://host/home/list/1 and url2=http://host/home/list/1)
i use such code
<%= Html.ActionLink("link", "DesignerFiles", "Home", null, null)%> url1
<%= Html.ActionLink(...
Could somebody show me how you would go about creating a mock HTML Helper with Moq?
This article has a link to an article claiming to describe this, but following the link only returns an ASP.NET Runtime Error
[edit]
I asked a more specific question related to the same subject here, but it hasn't gotten any responses. I figured it was ...
Here is the first part of my controller code:
public class ControlMController : Controller
{
IControlMService _controlMservice;
public IList<User> Users
{
get
{
if (System.Web.HttpContext.Current.Cache["users"] == null)
{
System.Web...
SQL query:
SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date
FROM ArticleCategories INNER JOIN
Articles ON ArticleCategories.CategoryID = Articles.CategoryID
Object repository:
public class ArticleDisplay
{
public int CategoryID;
public str...
I've created a website with ASP.NET MVC. I have a number of static pages that I am currently serving through a single controller called Home. This creates some rather ugly URLs.
example.com/Home/About
example.com/Home/ContactUs
example.com/Home/Features
You get the idea. I'd rather not have to create a controller for each one of the...
MVC newbie question re binders. Supposing I have two strongly typed partial actions that happen to have a model attributes with the same name, and are rendered in the same containing page i.e.:
Class Friend {string Name {get; set ;} DateTime DOB {get; set ;}}
Class Foe {string Name {get; set ;} string ReasonForDislike {get; set ;}}
Bo...
I changed the default namespace of my solution and assembly name, but i still get an error that there is abiguity between these even though the latter namespace is no where to be found.
httpHandler.ProcessRequest(HttpContext.Current)
NewName.Controllers.HomeController
OldName.Controllers.HomeController
...
Fellow stack overflowers,
I'm currently working on a project that has a sizable amount of both client and web code. The client code is written in C# and the web piece is written in PHP. Maintaining consistency between the two worlds is becoming cumbersome, and I want consolidate the web code to .Net.
The issue is that I hate web develo...
What I'm trying to do is rather basic, but I might have my facts mixed up. I have a details page that has a custom class as it's Model. The custom class uses 2 custom objects with yet another custom object a property of one of the 2. The details page outputs a fair amount of information, but allows the user to post a comment. When the us...
Hi all
There seems to be an issue with the default model binder when binding to an EntitySet causes the EntitySet to be empty.
The problem is described here and here:
Microsoft's response is:
... We have now fixed this and the fix will be included in .NET Framework 4.0. With the new behavior, if the EntitySet passed into Assign is t...
I'm trying to use the Html.DropDownListFor<> HtmlHelper and am having a little trouble binding on post. The HTML renders properly but I never get a "selected" value when submitting.
<%= Html.DropDownListFor( m => m.TimeZones, Model.TimeZones, new { @class = "SecureDropDown", name = "SelectedTimeZone" } ) %>
[Bind(Exclude = "TimeZone...
I am using jQuery .load to call an action but it is not found.
This is because the production website url is different to dev url.
function ProjectChange() {
var projid = $("input[name='ProjectLink']:checked").val();
$("#documentList").load("/Home/GetDocumentList/",
{ page: 0, projectid: projid },
...