In ASP.NET MVC 2, TempData values persist until the session ends or until they are read. In the words of Microsoft...
The value of TempData persists until
it is read or until the session times
out. Persisting TempData in this way
enables scenarios such as redirection,
because the values in TempData are
available beyond a s...
I have a controller post action that receives an IList<> as a parameter, and would like to iterate that list and TryUpdateModel for each item in the list. Like
[HttpPost]
public ActionResult SaveList(IList<Stuff> listOfStuff)
{
// Get existing list of Stuff objects
IList<Stuff> currentStuff = db.GetStuffList();
// iterate ...
In an asp.net mvc application, I would like to be able to generate views, where the routing engine will create all URLs that point to a different site, i.e. change the application path.
...
I found this ajax file upload script here http://www.phpletter.com/Demo/AjaxFileUpload-Demo/
Which is supposed to add ajax functionality to my file upload form
<div id="dialog" title="Upload Image">
<%
Html.BeginForm("Upload", "BugTracker", FormMethod.Post,new { id="uploadForm", enctype = "multipart/form-data"})...
I have an MVC2 app that utilizes MySql.Web ver. 6.2.2.0, on my dev machine locally it works fine!
However, once I upload it to my http://www.winhost.com account I get the following error:
Parser Error Message: Unable to initialize provider. Missing or incorrect schema.
Line 32: <clear/>
Line 33: <add name="MySqlMembers...
Okay, this may be involved...
Anyway, I am trying to learn how to use ASP.Net.
The environment is like this:
Windows 7 Professional
Visual Studio 2010
SQL Server 2008 Developer Edition
I am trying to follow the article here:
Developing and Unit Testing an ASP.NET MVC 2 Application - CodeProject
So far, I have installed IIS, IIS7 ...
Can anyone help me to write an Application using ASP.NET MVC 2 and LinqToSQL??? also explain the Repository Pattern!!!
...
Im using asp.net mvc 2. I have a model Supermodel that consists of 2 models TestModel1 and TestModel2.
In SuperModelView Im doing the following thing:
<%: Html.DisplayFor(x=> x.TestModel1, "TestModel1Template") %>
Its working just fine, except for the fact, that dropdownlist is populated but selected value is not set.
Im using the fo...
i have the code:
<%: Html.DropDownListFor(model => model.CompanyName, new SelectList(ViewData["ActiveCompanies"] as IEnumerable, "Id", "Name"))%>
the list is being populated properally with the names etc, but the selected item name is not being bound to the Model.CompanyName (it would be fine if the solution returns the id so i can ha...
Well I have this page
< %@ .............. Inherits="System.Web.Mvc.ViewPage < Something.Models.SomeModel >" %>
< % Html.RenderPartial("SomeControl",Model);% >
and this user control page
< %@ Control Language="C#" Inherits="System.Web.Mvc.ViewPage
< Something.Models.SomeModel>"%>
< p>< %: Html.TextBox("text",Model.Name) %>< /p>
an...
Hi,
I'm starting a new project which in simple terms will have a UI layer based on asp.net mvc 2, a business layer and a data access layer. Simple 3-tier design.
The UI layer though will be customized for the client, e.g. menus along the top, or down the left or maybe different static pages, etc.
All the core features will be the same a...
Is it possible to override the default 'There is no Data available' message in MVCContrib Grid with a custom message?
...
Hi
I have the model
public class PersonViewModel
{
public Guid Id { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
}
which is nested in an other view model:
public class ApprovalModel
{
[UIHint("MyDisplayTemplate")]
public PersonViewModel User { get; set; }
[Required]
...
I would like to control or customise the output generated by DisplayFor and EditorFor so it doesn't render the default html css tags for example:
.......
I would like this to be for all views not just a type or system type? And what is the simplest solution?
Any help would be appreciated.
...
hey,
I created a class that implements the IModelBinder interface. Within a method of that class I basically retrieve some values and try to validate them. If the validation fails, I add update the model state with necessary information like below:
DateTime mydate;
if (!DateTime.TryParse(convValue,out mydate))
{...
In my master page I have a placeholder where a Html.RenderPartial() will render a collection of (bread)crumbs which are effectively a list of links I build up using action, controller names and RouteValueDictionary's.
I have an action that is called from multiple places to view a short-list and so when building the list of breadcrumbs f...
I see "IoC" and "DI" mentioned pretty much everywhere for ASP.NET MVC. While I'm well aware of ... 'kind of' what these are, it's one of those almost ambiguous, amorphous floating concepts that seems to have either passed me by, or I'm just not looking in the right place. With the upcoming release of ASP.NET MVC 3.0, I'm seeing it even m...
I've got the following routing in my application...
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Branding",
"foo/bar.css",
new { controller = "DynamicContent", action = "CSS" }
);
routes.MapRoute(
"Default",
"{controller}/{ac...
I would like to pass the item list for a drop-down list into a strongly-typed partial view. The parent view uses a ViewModel class that contains the properties both for the value I want to set and the list of options the associated drop-down list should contain.
My ViewModel looks like:
public class EntityFormViewModel
{
private My...
I have an MVC2 application that is divided into Areas. Is it good practice for each area to have its own Content folder for Images, Styles etc that only pertain to that area?
...