It seems like everything I look up on this subject has either changed since the release or is wildly different from eachother.
I just want to create a simple form in my view.
Should I be using the Html.BeginForm()/TextBox()/EndForm() methods or should I be using a plain-jane HTML form? Which is preferred?
This is what I have so far:...
I am trying to found what is the best practice for view-controller communication for case when I need for example filtering.
I have collection of items on page and filter control. I am filtering items by letter, status, etc...
It is straightforward scenario, I am sending filter selected values to controller and controller gives back res...
Hi all,
I am struggling with WiewUserControls.
What I want to accomplish is View without knowledge of which usercontrol have to call with RenderPartial in order to render some html.
What I want instead is to give some kind of IViewEngine interface and then View can only call on certain place in template methods of IViewEngine that will...
I have a problem trying to layout my VS solution and I would like some suggestions, please.
Currently, my solution layout looks like the following project:-
Foo.Models
Foo.Repositories
Foo.Services
Foo.Web (an ASP.NET MVC application)
my website (Foo.Web) calls various methods on the Foo.Services namespace. The idea here is that the ...
In a DTO object I'd like to hard code the label description for the rendered html text box so that I can have an html helper function like TextBoxWithLabel where I pass only the object and it automatically creates the label taken from the description attributes.
public class MessageDTO
{
public int id { get; set; }
[Descriptio...
I've got an ASP.NET MVC application that uses jQuery. To load the js libraries, I reference them like this:
<script type="text/javascript" src="../../Scripts/jquery-1.3.2.min.js"></script>
This works fine locally, but when I publish it to the server, it can't find the library. To get it to work, I have to change it to this:
<script t...
I understand the reason for having the HTML helpers in ASP.NET MVC and extending this to provide your own, but I am wondering whether using HTML helpers is a good idea.
I thought one of the benefits of ASP.NET MVC is control over the HTML. If you start hiding it away in helper functions that generate HTML don't you start losing visibil...
In WebForms, I would normally have code like this to download a PDF:
Response.Clear()
Response.ClearHeaders()
'//Send the file to the output stream
Response.Buffer = True
Response.AddHeader("Content-Length", pdfData.Length.ToString())
Response.AddHeader("Content-Disposition", "attachment; filename= " & Server.HtmlEncode(filename))
'//...
I have overriden the DefaultControllerFactory by using CustomControllerFactory which is actually using StructureMAp ObjectFactory to construct the Controller Instance using IOC. But some how it can not find the Controller instances and failing over it.
Note. I already set the DEfaultControllerFactory in Global.asax too. So is there anyth...
What is the replacement for a server control in ASP.NET MVC? What I want to do is to create a declarative and imperative binding so I can write
<cc1:MyControl Header="Some Header" Content="Some Content" />
which would mean that an instance of the MyControl class will be created and possibly rendered to
<h1>Some Header</h1>
<p>Content...
I'm working with an ASP.NET MVC site which will use a CMS controller for all pages of the site except for the home page. Here's the idea:
Home controller:
www.site.com
www.site.com/default.aspx
CMS Controller:
www.site.com/about
www.site.com/agenda/schedule
www.site.com/monkey/eats/spaghetti
(pretty much anything else)
This page...
EDIT!! I should add that this site runs perfectly locally. It's only when deployed that there's this issue
ORIGINAL POST:
I have a site I just put up http://splattonet0.web704.discountasp.net/
Which loads the Index view of the Home controller just fine. However, when one clicks the links to the left, the webserver is looking fo...
Suppose each user has certain preferences that is saved in database for that user.
For example: UnitSystem, UILanguage, TimeZone,...
When an http-request is made we need to have access to user preferences (e.g UnitSystem, TimeZone, ...) to correctly process the data and render the view in the correct language.
What is the correct way t...
Having problems with this setup what im trying to do is like so.
Steps
Fill out all elements of a Ajax.BeginForm().
Click submit
The Ajax form then renders a partial view.
The partial view has a list of tabs that handle different tasks.
All tabs essentially have their own partial view.
When each partial view is loaded they perform the...
How do I create a partial view that has a form with assigned id?
I got as far as:
using (Html.BeginForm(?action?,"Candidate",FormMethod.Post,new {id="blah"}))
Partial view is used for both Create and Edit so first parameter ?action? will be different. I can't figure out what value of ?action? supposed to be
...
I have an asp.net MVC application that calls another service to generate a pdf. I want the user to be able to click a link in my View and get a 'save as...' dialog from the browser to save the pdf.
The call to the 3rd party service is made in a Model using WebClient.
How to get I the data from the WebClient call up to View and out to ...
I'm just learning ASP.NET MVC and my first project is to create a simple link directory (like DMOZ).
I can easily build a strongly typed view of a list of subcategories for a category.
I can easily build a strongly typed view of a list of all the sites in a particular category.
Now, here's what I'm having trouble wrapping my head arou...
I have two controller actions with the same name but with different method signatures. They look like this:
//
// GET: /Stationery/5?asHtml=true
[AcceptVerbs(HttpVerbs.Get)]
public ContentResult Show(int id, bool asHtml)
{
if (!asHtml)
RedirectToAction("Show", id);
var result = Stationer...
I have followed the the article on asp.net.mvc, Validating with a Service Layer. This all works fine until I come against a custom ModelBinder. If a form item fails validation within my Service Layer, I update my Validation Dictionary (which is the ModelState passed in by the calling Controller) and all is well. When the Controller passe...
I have a controller defined as:
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult PostMoreData(DataContracts.Address address, DataContracts.GeoLocation geoLocation)
{
return Json("test");
}
where DataContracts.Address and DataContracts.GeoLocation are complex types.
From my View i'm trying ...