I am using javascript to append user selections to a list. When user is done , which is the best way to go:
1: create index for the list and submit as model in a form to the controller?
2: create hidden element and use javascript to append values and submit as actionlink? (not sure how to tell actionlink the value here)
3: wrap form b...
I have a set of websites built in MVC - each, essentially, is a clone of one original site). On one of the sites I'm getting the error from the title of this post ("The given key was not present in the dictionary") - it only occurs on a single page. The code is identical across all of the sites including the one which is acting up. Each ...
I want to be able to set a long expires time for certain items that a user downloads via GET request.
I want to say 'this is good for 10 minutes' (i.e. I want to set an Expires header for +10 minutes). The requests are fragments of HTML that are being displayed in the page via AJAX and they're good for the user's session. I don't want t...
Hi,
I have a ASP.NET MVC app that is using SQLite database through Entity Framework.
Everything works on VS 2008's local development webserver.
However, deploying the web app to my service provider causes this error:
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Dat...
Having seen how NInject can do it and AutoFac can do it I'm trying to figure out how to inject dependencies into MVC ActionFilters using Castle Windsor
At the moment I'm using an ugly static IoC helper class to resolve dependencies from the constructor code like this:
public class MyFilterAttribute : ActionFilterAttribute
{
priva...
Hello.
I'm trying to bind the following enum
public enum CertificateTypes : byte
{
None = 0,
Original = 1,
AuthenticatedCopy = 2,
Numbered = 3
}
to a tinyint column on the database. However, when creating the SelectListItems and calling, for instance, Person.CertificateTypes.Original.ToString() I get this:
<option va...
I am trying to make a custom HTTP 404 error page when someone types in a URL
that doesn't invoke a valid action or controller in ASP.NET MVC
Instead of it displaying the generic Resource Not Found ASP.NET error
I don't want to use the web config to handle this...
Is there any kind of routing magic I can do to catch any invalid urls?
...
Hi,
In my ajax call, I want to return a string value back to the calling page.
Do I still using ActionResult or just return a string?
...
How do I create a custom attribute to extend existing Authorize attribute in MVC?
...
I am using Netegrity's SiteMinder single sign on for a subset part of my development machine. Something like https://testdev.com/sm/testapp where /sm is my SiteMinder configured location.
However, when I run ASP.NET MVC apps in a virtual directory under the /sm folder I get some unexpected results from Url.RouteUrl or Html.BeginRouteFor...
I'm very new to ASP.NET MVC, but even more than that, I'm very new to web development in general. What I want to do is simple. I have a folder in my MVC project called /Content/Images where I have some images. I'd like for my controller to grab all the images in this folder, and send them to the view. The view will then render these imag...
I have a dropdown list on my asp.net mvc site:
<%= Html.DropDownList("CustCodes") %>
My controller:
ICallService sc = new CallService();
IList<CustCode> custCodes = sc.GetCustCodes();
ViewData["CustCodes"] = new SelectList(custCodes, "ID", "Name");
What I want is once the dropdown is displayed to either have a blank entry at...
I know how to use MVC's AntiForgeryToken attribute and it's associated HTML helper to help XSRF-secure my application's form POSTs.
Can something similar can be done for JsonResults that implement GET?
For instance, my View contains an onSubmit jQuery call like such:
$.getJSON("/allowActivity/YesOrNo/" + someFormValue, "{}", function(...
Latest Asp.Net MVC RC permits to return JavaScript ActionResult.
I'd like to dynamically generate from the controller the Jquery script code associated to perform the classical $.ajax calls to the controller for Create Read Update Delete operations in ajax instead of classical get/post form actions.
Should I generate the javascript code ...
Hello all,
I trying to work out if there is built in support for binding complex types to form elements.
To use a common hypothetical situation:
I have a Product entity that belongs to a Category - the models look something like this:
public class Product
{
public int ID { get; set; }
public string Description {...
I have a route table similar to this
// Allow browsing categories by name, instead of by ID.
routes.MapRoute("Categories", "Categories/{action}/{name}",
new { controller = "Categories", action = "Index", name = "" }
);
// All other pages use the default route.
routes.MapRoute("Default", "{controller}/{action}/{id}",
new { controller ...
How do you create a MembershipProvider for use in an ASP.NET/MVC website?
Doesn't it generate the tables it needs for you in your database?
...
I'm trying to build a "New Customer" form, so I'm using the default model binder to build my Customer object:
public ActionResult New(Customer customer) { ... }
The only problem is I have a few properties on the Customer object that aren't required. When I leave these fields blank, ASP.NET MVC automatically throws up model errors stat...
Whats the earliest point I can programatically get to the name of the masterpage that will be used in an asp.net MVC application?
The idea being changing the viewdata used depending on the master page. I want to be able to set something as early as possible so that individual developers don't need to know to populate it. Ideally it woul...
I am using the Microsoft Ajax Template DataView to bind values to a template. I can do this and it works as you'd expect:
<h3>{{ID}}</h3>
<p>{{Address}}</p>
However I am trying to build an action link that has the ID in it.
<h2><%= Html.ActionLink(Html.AttributeEncode("{{Name}}"), "Index", "Restaurant", new { Id = Html.AttributeEncod...