Im trying to get my strongly typed master page to work in my ASP MVC 2.0 application.
I have come far with the help of these two posts:
Passing data to Master Page in ASP.NET MVC
Strongly Typed ASP.Net MVC Master Pages
Problem is that im not sure how to get that ViewDataFactory code to work, this is my code:
BaseController.cs
public...
I have a form to which I want to add extra fields depending on the value of a dropdown list. They would be sets of fields and I was thinking on dynamically changing a div's content with the html from a render partial, which would render a PartialView with the fields I want.
Right now the code for the drop down list is the following
...
How does HtmlHelper.ActionLink(htmlhelper,string linktext,string action) figures out correct route?
If i have this=>
HtmlHelper.ActionLink("Edit","Edit")
Mvc automatically finds out correct route.
i.e. - if controller was Product, it will render anchor with href product/edit.
So - how to figure out controller name when i got htmlHe...
Say you create an object and saving to database by using ADO Entity Framwork as in the code below.
private void CreateAddress(BizObjects.Address address)
{
var entity = new EntityFramework.Address();
entity.Line1 = address.Line1;
entity.Line2 = address.Line2;
entity.City = address.City;
entity.State = address.State;...
I have many Ajax.ActionLink's on my ASP.NET MVC (v1) page that perform destructive operations. This is "legal" because I set HttpMethod to DELETE in this case so it's not a destructive GET.
My question though is how to mitigate XSRF attacks on this operation so that other sites cannot craft this same Ajax DELETE request to delete use...
Let's start with this basic scenario:
I have a bunch of Tables that are essentially rarely changed Enums (e.g. GeoLocations, Category, etc.) I want to load these into my EF ObjectContext so that I can assign them to entities that reference them as FK. These objects are also used to populate all sorts of dropdown controls. Pretty stand...
In several sample projects, I've seen ViewModels being used to convert data objects into strings, for use in the View.
The ViewModel will typically have a constructor that receives one parameter - a data object. The constructor will then populate various properties of the ViewModel (mostly strings and ints).
This prevents any complex l...
I have a very weird problem with resx based localization.
At first, let me explain, how it is done for me right now.
It is ASP.NET MVC project. I have two assemblies: web and domain. Web contains all MVC related stuff, and domain, well, contans domain classes. Also, in domain assembly I store a lot of static resources for localization(I ...
I auto-generated a controller, and it includes calls such as:
//
// GET: /User/
public ActionResult Index()
{
return View();
}
//
// GET: /User/Create
public ActionResult Create()
{
return View();
}
What determines the actual view (.aspx file) that these parameterless View() calls invoke?
...
How do redirections work in ASP.Net MVC?
I've copied and modified the code bit from Scott Henselman's blog that uses DotNetOpenId to login via OpenID. Debugging, I find that when executing this code segment:
// Stage 2: user submitting Identifier
var openId = Request.Form["openId"];
new OpenIdRelyingParty().CreateRequest(openId).Redire...
I have a simple form in ASP.NET MVC. I am trying to post these results to a controller action and I am getting strange behavior.
The view is a simple HTML table:
Here is part of the HTML form View:
<form action="/Applications/UpdateSurvey" method="post"><table id=questionsTable class=questionsTable border=1>
<thead><tr><td>Name</...
I am new to MVC.I have some doubts.
1) My MVC Application contains
i)Default.aspx
ii)Views
... Home
... About.aspx
... Index.aspx
during execution which one will load first Default.aspx ? or About.aspx?
2) I want to display a webpage that lists menu items (LinkButtons)as st...
I'm working with some WebForms/MVC-agnostic tools, and I need to get an instance of HttpContext given a reference to an HttpContextBase object. I can't use HttpContext.Current because I need this to work asynchronously as well (HttpContext.Current returns null during an asynchronous request). I'm aware of HttpContextWrapper, but goes the...
I have a small asp.net mvc app running on WIN2k3 and IIS6.
I'm using a wildcard mapping under the application settings in IIS as described in this article http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx . The application works fine under my local asp.net development server. When I publish from VS2008 out to ...
It doesn't return a view. In fact, the Action still needs to return a view after calling this ... so what's going on?
...
Hi
I have in my c# code a class with 3 properties.
public class Sender
{
public string Id {get; set;}
public string html {get; set;}
public string AnotherField {get; set}
}
So I have a list collection.
List<Sender> test = new List<Sender>();
So I return this as a Json result in my view
public Json myView()
{
return Js...
Explanation of scenario:
I have a jquery window that will load up with a map control. This map control is a shared control in an asp.net MVC application. The way I've been told by Jquery developers is to use a $('').load(''); function to call into a controller which returns the control. Is this the best way? If so, how do i use the cont...
I'm not getting to hang of the entire FormAuthentication thing. Is there an up-to-date tutorial somewhere? I found this one, but it a bit old and the syntax doesn't match recent Asp.Net MVC.
...
I've wrote custom model binder in project, that uses ASP.NET MVC 2. This model binder bind just 2 fields of model:
public class TaskFormBinder : DefaultModelBinder
{
protected override void BindProperty(ControllerContext controllerContext,
ModelBindingContext bindingContext,
PropertyDescriptor propertyDescriptor)
...
I have an application that is using .net's Entity Framework. This application runs fine on my local machine and my local server. However, trying to run the app on mosso which runs in medium trust returns an error.
I am not sure how to appropriately use entity framework in medium trust. I have the entity model in a separate project ...