I have the following code-
View-
<% Html.BeginForm(); %>
<div>
<%= Html.DropDownList("DropDownSelectList", new SelectList( Model.DropDownSelectList, "Value", "Text"))%>
Controller-
public ActionResult Admin(string apiKey, string userId)
{
ChallengesAdminViewModel vm = new ChallengesAdminViewModel();
vm.ApiKey = apiKey;...
I have used response.redirect in classic ASP and ASP.NET webforms. However, with MVC 2.0, I am running into something peculiar.
I have a private method in a controller class that is used by multiple controller methods to help load and validate some information. This private method is setup to redirect if a problem is discovered to a...
I am trying to secure a controller action to prevent a user from accessing an Entity that they do not have access to. I am able to do this with the following code.
public ActionResult Entity(string entityCode)
{
if (CurrentUser.VerifyEntityPermission(entityCode))
{
//populate viewModel...
...
Good morning
can anyone jot down a complete sample for creating an asynchronous comment mechanism like this, but focusing on ASP.NET MVC?
...
Hi, for some reason when I use the following code
TimeSpan timeDiffUtcServer = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
it returns -07:00:00 offset
I am using Windows XP and my timezone is set to Pacific time -08:00. I am running this through VS 2010's built in IIS server which is on my computer, so I can't figure out wh...
Given a basic repository interface:
public interface IPersonRepository
{
void AddPerson(Person person);
List<Person> GetAllPeople();
}
With a basic implementation:
public class PersonRepository: IPersonRepository
{
public void AddPerson(Person person)
{
ObjectContext.AddObject(person);
}
public List<...
I'm writing an ASP.NET MVC 2 application where one of the backing stores I plan to support is XML. I have a POCO that represents the settings for the site, along with an XML file to contain these settings. My question is what is the best way to validate this data as it is read from disk in to the POCO? I know I can use an XSD, or mayb...
I have an issue with the DotNetOpenAuth sample projects.
I have Visual Studio 2008, with MVC1 installed, yet when i try open the samples.sln the 2 MVC projects fail to load, giving the error:
"Project type not supported"
Is there additional requirements other than VS an MVC?
...
I'm wondering if it's possible to conditionally add a parameter in a call to a method.
For example, I am rendering a bunch of links (six total) for navigation in my Site.Master:
<%= Html.ActionLink("About", "About", "Pages") %> |
<%= Html.ActionLink("Contact", "Contact", "Pages") %>
<%-- etc, etc. --%>
I'd like to include a CSS clas...
Hello everybody,
There are string length limitations in database structure (email is declared as nvarchar[30] for instance)
There are lots of html forms that has input textbox fields that should be limited in length for that reason.
What is the best practice to synchronize database fields and html layout input fields length limitations...
I'm working on getting FluentValidation working with Castle Windsor. I already have a wrapper around Castle Windsor. Here is the code for that:
public class ResolveType
{
private static IWindsorContainer _windsorContainer;
public static void Initialize( IWindsorContainer windsorContainer )
{
_windsorCont...
I'm working on getting an MVC app up and running via AD Membership Provider and I'm having some issues figuring this out. I have a base configuration setup and working when I login as [email protected] + password.
<connectionStrings>
<add name="MyConnString" connectionString="LDAP://domaincontroller/OU=Product Users,DC=my,DC=do...
In learning WCF, I'm a bit confused where to go to figure out how I should be handling user authentication. My MVC 2 app uses an Active Directory Membership Provider and this works and is good, but my MVC app doesn't really do anything but call my WCF services. My business logic on the other side of WCF is what really does everything (as...
can we get the multiple values from a select tag through Ajax script in controller in asp.net MVC?
I Have tried for Single Value that I have done by .val Function..
But not for Multiple Values
Any suggestion Please Help
...
I have a list of objects that are organized in a tree using a Depth property:
public class Quota
{
[Range(0, int.MaxValue, ErrorMessage = "Please enter an amount above zero.")]
public int Amount { get; set; }
public int Depth { get; set; }
[Required]
[RegularExpression("^[a-zA-Z]+$")]
public string Origin { get...
I'm using a content management system whose admin interface uses MVC 1.0. I would like to build the public parts of the site using MVC 2.
If I just reference System.Web.Mvc version 2 in my project the admin mode doesn't work as the reference to System.Web.Mvc.ViewPage created by the views in the admin interface is ambiguous:
The type...
public ActionResult Edit(int id, FormCollection formValues) {
// Retrieve existing dinner
Dinner dinner = dinnerRepository.GetDinner(id);
// Update dinner with form posted values
dinner.Title = Request.Form["Title"];
dinner.Description = Request.Form["Description"];
dinner.EventDate = DateTime.Parse(Request.Fo...
How can I log client side javascript errors to the server? I'm using jQuery and MVC.
...
Hi,
I am working with small ASP.NET MVC project - online store.
I have addToCart method which adds selected product to cart - it updates cart table in my db and showing cart view with its content. But I have problems. While db is updating correctly the view does not. I see that quantity of the product in my db is incremented correctly ...
Thus far worked with asp.net mvc1 and just started with asp.net mvc2..... what are good candidates for executing a controller asynchronously? Should i use it for long running process or some background processing? What are the pros and cons choosing asynchronous controller in asp.net mvc 2? Any suggestion...
...