I have a DropDownlist that prompts a user for the State, when the user selects a state, ie. Colorado, it saves 'CO' in the database, works great. When the user goes back to the page, it shows 'CO' in the dropdown, but when the page posts back, the dropdownlist value is null. If I manually select a State again, posts back with the corre...
I have an ASP.NET MVC app and I have a WebForm page I built in the MVC due to a tutorial on how to do something I needed to do, but it was all in WebForm style. Ive tried to figure out how to do the same thing in MVC format but cant figure it out. So I was needing to figure out how to use this page in my MVC app. But when I try to go to ...
I have the following database schema:
Here's how I populate a DropDownList in my AreaController.cs:
public ActionResult Edit(int id)
{
Area area = areaRepository.GetArea(id);
JefeRepository jefe = new JefeRepository();
ViewData["Jefes"] = new SelectList(jefe.FindAllJefes().ToList(), "ID", "Nombre", area.Jefe.Nombre);
r...
If I do not want to do this in my View Markup,
<%=Html.RouteLink("Listings", "Listings", new {market = "Austin", state = "Texas", pagenumber = 3 })%>
what would be the best approach to creating links in MVC 2? I have a HTML helper to build a custom link but all it is doing is acting as a wrapper around RouteLink (or ActionLink). ...
Greetings. I have a problem with Remember Me possibility. It didn't remember my login. First of all I checked FormsAuthentication.SetAuthCookie( userName, createPersistentCookie ); in SignIn method. The second parameter is true if I checkbox is cheked. Also I've checked the cookie named .ASPXAUTH
( http://img412.imageshack.us/img412/3585...
I have to write a Unit test for this method but I am unable to construct HttpPostedFileBase... When I run the method from the browser, it works well but I really need an autoamted unit test for that. So my question is: how do I construct HttpPosterFileBase in order to pass a file to HttpPostedFileBase.
Thanks.
public ActionResult ...
I'm following the MVC2 NerdDinner tutorial and I can't make heads or tails of the model validation area.
I have an Area class created by my .dbml. Then I created a partial Area class myself and added:
partial void OnValidate(ChangeAction action)
{
if (!IsValid)
throw new ApplicationException("Rule violations prevent saving");
}...
Hi.
I am converting a webforms app to mvc. I implemented localization in webforms this way:
The user selects the language, which BTW can be an rtl language, and the selection goes into the user profile in order for it to persist the next time the user visits the site. I used anonymous profiles.
also, I used resource files.
The db table...
Using the model-first approach, I made 2 entities: Project and User. A project has multiple Users (involved in the project), and a User has (access to) multiple Projects, so following along with the Tekpub video, I made the many-to-many navigation property using the primary keys of the two entities.
I made some test data, and the data ...
How Can i use renderaction to render an action from inner Area in ASP.NET MVC 2.0?
...
Hi,
How do I store a variable or object application wide in ASP.net MVC. In regular ASP, you had the Application object, and in ASP.net too apparently.
I'm using ASP.net MVC 2.
Thanks!
Yvan
...
Hello all!
I've got two classes in my MVC project Order and Product.
Because Product can be ordered many times and Order can have many products I've got third entity which is OrderedProduct. It joins those two entities in many-to-many relation.
Now what I'm trying to do is to let user to make an order by putting products from the drop...
I've currently got a BaseController class that inherits from System.Web.Mvc.Controller. On that class I have the HandleError Attribute that redirects users to the "500 - Oops, we screwed up" page. This is currently working as expected.
THIS WORKS
<HandleError()> _
Public Class BaseController : Inherits System.Web.Mvc.Controller
''...
I'm working through some Error stuff, and I've tried converting Richard Dingwall's example over to VB.NET. The problem is that I'm getting an error:
Type ResourceNotFoundException is undefined
'<AttributeUsage(AttributeTargets.[Class] Or AttributeTargets.Method, Inherited:=True, AllowMultiple:=False)> _'
Public NotInheritable Class...
I'm having a heck of a time figuring out how to properly implement my 404 redirecting.
If I use the following
<HandleError()> _
Public Class BaseController : Inherits System.Web.Mvc.Controller
''# do stuff
End Class
Then any unhandled error on the page will load up the "Error" view which works great. http://example.com/user/999 (whe...
I have a custom handler I've written that executes a custom action based on a parameter, for example:
/action/option1
would execute the action handler with option1. I can have any number of options for the parameter...
however this action is a custom handler, NOT an mvc controller, because I'm returning a plain text (possibly moving t...
I'm following Pro ASP.Net MVC2 book and literally 90% of everything is new to me. I feel like a kid in a candy store! :)
Unit testing, dependancy injection, and other things are really new and very foreign to the typical CRUD applications I create.
Now I'm having trouble with a test the book asks us to design.
[Test]
public vo...
I have the following domain class:
public class Product
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual IList<Product> RelatedProducts { get; set; }
}
I have the following DTO class:
public class ProductDTO
{
public ProductDTO(Product product)
{
Id = product.I...
In Visual Studio Professional 2010 whenever I type the following:
new {
It automatically changes to:
new object {
Is there a way to make it not do this? "Object" does not have the properties of the object I want to anonymously create.
...
Hello,
Visual studio crashes as soon as I open aspx or ascx View from MVC 2.0 project.
If I delete all bin and obj folders from projects, I can open aspx and ascx View page. But it crashes again after compiling.
It started to crash after I moved strong typed model to different project.
I got stuck and cannot go further, really frustrat...