I've got customErrors set in my web.config
<customErrors mode="On" defaultRedirect="/Error/GeneralError">
<error statusCode="404" redirect="/Error/NotFound"/>
</customErrors>
This works fine locally. A 404 throws a 404. On the shared hosting it throws up the standard server 404 page unless I specifically set 404 to point to /Err...
I am trying to edit a record. I have the default route.
When I click the submit button I get an exception on the UpdateModel line:
The model of type 'MyProject.Mvc.Models.Product' could not be updated.
On the page the validation of the ProductId field is prompting the value is invalid:
The value '9' is invalid. 9 is the id of the record ...
Is it possible to import a namespace from an assembly that is not in the bin folder?
I'm using ASP.NET MVC 2 with MEF to pull controllers out of the assembly.I was able to get everything working, however, strongly typed views can't recognize the assemblies' objects unless the assembly is in the bin folder.
...
How do you associate a MultiSelectList with a list of checkboxes?
eg. I pass something like this to the model
model.Groups = new MultiSelectList(k.Groups, "Id", "Name", selectedGroups)
How should I render it? This doesn't work
<% foreach (var item in Model.Groups.Items) { %>
<input type="checkbox" name="groups" value="<%=item.Va...
Not so much a "How to" of how to use the framework, but a good description of how the framework itself is put together?
web site? book?
or just the source code? :-)
...
The problem: Using ASp.NET MVC for reporting.
Given:
1. A report that is tabular in output, so it can easiyl be represented by a class (static field list).
2. A filter mask containing halfa dozen or more possible conditions to apply to the data.
How is the approach for the MVC file layout?
I would say one controller for the complet...
Hello,
I trying to test an AccountController that uses DotNetOpenAuth but I am running into a problem. I want to test the Logon Actionresult to see that it is returning the correct views. The test fails because realm(I think) has a contract that requires the HttpContext.Current not to be null. I think I have to mock the request somehow ...
I'm building an MVC based system which should manage requests, thats is, a user of the system fills in a request form, the form is passed to some authority for handling and there might be many other proccessing to the form in the way.
I want to be able to save History/Versions of the form, what i mean is, if a user fills in a form a yea...
I'm still figuring out a few of the finer points around unit testing my ASP.Net MVC2 application using NUnit.
On the whole, testing my ActionResults, models, respositories and the like is straight-forward, but I've not had to test Ajax methods before and I'd like some guidance on how I should best go about it.
Thanks in advance.
...
the more I think about it the more I believe it's possible to write a custom route that would consume these URL definitions:
{var1}/{var2}/{var3}
Const/{var1}/{var2}
Const1/{var1}/Const2/{var2}
{var1}/{var2}/Const
as well as having at most one greedy parameter on any position within any of the upper URLs like
{*var1}/{var2}/{var3}
{v...
How could I implement loading timer that are automatically appended to the each displayed page in ASP.NET and MVC?
I was thinking to implement it in Global.asax. To log the start of the request and and the end calculate a time and then smartly append it to output stream somehow. It could also be implemented in HTTP handler ...
I would ...
This question is related to the this.
I'm using the following to extract the attributes & values from the select elements on my page:
var valuesArray = $("select").map(function()
{
return $.getAttributes($(this).find(":selected"));
});
var arr = new Array();
$.each(valuesArray, function()
{
arr.push($(this)[0]); // this filter...
I am using HTML controls while using Ajax in my .net project. Now I want to make my text box to be autocomplete. I am fetching a data using a query for the respective typed text but i am not sure how to bind that data to text box and show it the way it is being displayed in google and other famous sites. I would also love to know the way...
ASP.NET MVC 2 Dots Replaced With Underscore In Element Name (even though ASP.NET MVC will put dots in by default in the name attribute!)
When you stick an element on a form in ASP.NET MVC, it usually does the following:
<%= Html.TextBoxFor(model => model.Contact.FirstName)%>
Becomes
<input type="text" name="Contact.FirstName" id="Co...
I am designing a custom HTML helper and I would like to execute Html.ActionLink to provide dynamic URL generation.
namespace MagieMVC.Helpers
{
public static class HtmlHelperExtension
{
public static string LinkTable(this HtmlHelper helper, List<Method> items)
{
string resu...
Hi,
I have a viewmodel that contains a product and SelectList of categories.
public class AdFormViewModel
{
public AmericanAds.Model.Ad Ad { get; set; }
public SelectList Categories { get; set; }
public AdFormViewModel(AmericanAds.Model.Ad ad, SelectList categories)
{
Ad = ad;
Categories = categories;
...
I have implemented a service which uses a DAOFactory and a NHibernate Helper for the sessions and transactions. The following code is very much simplified:
public interface IService
{
IList<Disease> getDiseases();
}
public class Service : IService
{
private INHibernateHelper NHibernateHelper;
private IDAOFactory DAOFactory;...
On this site if you do too many clicks or post comments too fast or something like that you get redirected to the "are you a human" screen. Does anybody know how to do something similar?
...
I have an URL like this /home/action/id
How can I access this id in view?
...
I am running into an issue with ASP.NET MVC where it is forcing the user to log back in after about 20 mins of inactivity.
I am using Forms Authentication and have increased the time-out in the config file as:
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="9999999" />
</authentication>
I am also setting th...