I would like to keep model binding when doing ajax calls from my view. I'm using jquery ajax to make the calls, and just as an example- this is my controller method I want to call from ajax:
public ActionResult Create(Person personToCreate) {
//Create person here
}
As you can see, this method is relying on Model Binding. This make...
Suppose I have a model and a view that display this model properties.
public class UserModel
{
public string UserName { get; set; }
.................
}
somewhere in a view...
<%= Model.UserName %>
Now I rename one of the properties (say, UserName => FullUserName), VS will suggest to perform refactoring meaning project-wide ...
I am using ASP.Net MVC along with Jquery to create a page which contains a contact details section which will allow the user to enter different contact details:
<div id='ContactDetails'>
<div class='ContactDetailsEntry'>
<select id="venue_ContactLink_ContactDatas[0]_Type" name="venue.ContactL...
Trying to create a select list with a first option text set to an empty string. As a data source I have a List of a GenericKeyValue class with properties "Key" & "Value". My current code is as follows.
<%= this.Select(x => x.State).Options(ViewData[Constants.StateCountry.STATES] as IList<GenericKeyValue>, "Value", "K...
Hello,
I am using a fileContentResult to render a file to the browser. It works well except that it throws an exception when the fileName contains international characters.
I remember reading somewhere that this feature does not support international characters but I am sure there mustbe a workaround or a best practice people follow in ...
Hi,
Is it possible to post data in .ASCX ? I guess NO ! If so, how I can accomplish this ? Here is what I am trying to achieve:
I am planning to create TABs in asp.net mvc page. Each and every tab will have different functionality with CREATE/EDIT/DELETE operations. I was thinking that I can create .ASCX and do RenderPartial in .ASPX. Bu...
I was recently taking a look at the Kazi Manzur Kigg MVC implementation (Kazi rocks) and noticed some code that seemed to defeat the DRY/SOC principle. I'd love to have everyone's thoughts on a possible refactor to separate concerns.
Kigg implements both an Add and Remove method on each repository class ( Note: BaseRepository has virtu...
At which layer (Model, View, Controller) of MVC should permission logic be handled?
Let me clarify that a bit.
Obviously the UI (View and Controller) need to be able to access permissions to show/hide components and to handle the permission denied scenario. It also seems obvious that the permissions should be persisted to the database ...
How would you build a price comparison script? I know Amazon offers a public API, but I saw these two sites goodreads, bookdope which compare book prices, retrieve prices from Walmart and others websites that do not offer APIs. How do you get prices from sites that do not have an API?
I'm using C# and ASP.NET MVC.
...
I am having issues adding validation methods to a couple of controls in my MVC app. I use the following to test for the mm/dd/yyyy format:
if (!Regex.IsMatch(candidateToEdit.availability.StartDate.ToShortDateString(), @"giantregex"))
ModelState.AddModelError("availability_StartDate", "Start date must be in the mm/dd/yyyy for...
So, I'm creating an ASP.NET MVC website.
It has a fairly complex user sign-up page with a lot of fields. My question is, where should I persist this? The user tables created by the membership-provider tool don't contain these columns and I'm left confused about what the best practice is in terms of storing this additional information ...
I deployed the sample application (the blue one you get when you create a new project) to IIS7 on Windows Server 2008. When I try to access mysite.com/home/about I get redirected to Accoun/Login.
This does not happen when I run the site on VS integrated server.
I did not change any code in the project, so it sems to be an issue on the ...
Hello,
I'm having problems repopulating a TextBox from data coming from a complex structure involving Dictionaries.
So, I have VM structure like this:
public class AnswerVM
{
public int Index { get; set; }
public Answer Answer { get; set; }
public Dictionary<int, QuestionResult> QuestionResults { get; set; }
}
public class Questio...
Hi guys
I'm using asp.net MVC with output caching (the OutputCache attribute) on some of my controller methods and am getting some really weird results in the HTTP headers.
When I add the attribute to the controller action that handles the main page view. the following header is produced:
Date Thu, 16 Jul 2009 23:0...
I have a virtual directory created and a sub domain that points to that virtual directory. My links always route to subdomain.domain.com/subdomain/controller/action when they can leave off the subdomain link. Is there an easy way to stop that?
Also, it's the same problem when I mapped anotherdomain.com to my virtual directory. It end...
I am doing an MVC with C# application. I was trying to access the entire row in a table and change the values in each cell using jquery.
I need to do change the value in each td once a json call is succeeded.
Please advice for this
...
All the examples I've seen for overloading usually have only two methods of the same name with different parameters and one using the GET verb while the other uses POST. Is it possible to do two or more overloads on the same method, all with the same verb?
Here's an example of what I'm referring to: http://stackoverflow.com/questions/4...
I am in the process of learning ASP.NET MVC and I am learning it by walking through nerd dinner application.
I am having trouble understanding the ASPX and ASCX files. The way of writing the code in ASPX files seems pretty weird (code is split in multiple lines).
Please can you suggest any online tutorial/guide/article which can expla...
I have a partial view in my test ASP.NET MVC application. This view is responsible to display application menu buttons.
I want to change the color of button which is currently active page. Currently I have written something like:
<ul id="menu">
<% var activeClass = (string)(ViewData["currentPage"]) == "Home" ? "activeMenuButton" : ...
In asp.net MVC the "homepage" (ie the route that displays when hitting www.foo.com) is set to Home/Index .
Where is this value stored?
How can I change the "homepage"?
Is there anything more elegant than using RedirectToRoute() in the Index action of the home controller?
I tried grepping for Home/Index in my project and couldn't fi...