I need to do some validation where 1 of 2 fields must be entered.
What is the best was to do this in MVC 2?
The fields are;
<%: Html.EditorFor(model => model.contract.ClientOrderNumber)%>
and
<%: Html.TextAreaFor(model => model.contract.InstructionWithoutClientOrder,
new { maxlength = "255", style = "width:2...
Here is the thing. I have an Edit view, which doesnt bind the dropdowns' value when I open it.
[NonAction]
public List<SelectListItem> VraagType() {
List<SelectListItem> l = new List<SelectListItem>();
SelectListItem a = new SelectListItem();
SelectListItem b = new SelectListItem();
a.Text = "Mee...
Hi
I'm using the Jquery full calendar plugin, and i want to be able to click on an event and the details of the event to be populated via AJAX into a div with the id of #details.
here is my controller action that i'm trying to load. When debugging, the action does not consider the incoming request to be AJAX and returns the full view ...
Hi everyone!
I'm building web shop in ASP.NET MVC.
I have two entities: Category and Product.
One product can belong to one or more categories.
On webpage, user can see a list of categories. By clicking category name, he can see all products in that category. User may also search products by name, category, price, etc.
Controllers
Whi...
I have the following controller:
class FooController : Controller
{
public ActionResult SomeAction(id)
{
Type t = Type.GetType(id);
object o = Activator.CreateInstance(t);
((MyModel)o).ParseParamaters(PostParameters); // I need to pass the post parameters here
//...
}
}
I would like to fetch all the POST pa...
I am surprised how much work is involved in MVC to check if at least one of 2 fields has been entered.
My solution is derived from a book, you may recognise it!
What does not exist in the book is a way to display the error message.
So how do I do that?
In global.asax, Application_Start I put;
ModelValidatorProviders.Providers.Add(new Cus...
I am using a helper in my controllers and in my views that I have found somewhere on the internet. The helper is called like this in my controller "Url.SiteRoot();"
How can I get my controller to not throw an Exception whenever the helper is called? I am using MVCContrib and moq for my unit tests.
I am thinking of implementing some kind...
I'm trying to build a select list that will contain some prioritised values, then a separator, and then the rest of the values. I need to do this in a Html Helper, as I will get the values that will be prioritised and the rest of the values from different sources.
Sample of what I want to accomplish:
EUR
GBP
USD
---
SEK
ZAR
.
.
.
I ...
Hi,
I have created an Address user control which is as follow:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Address>" %>
<div class="span-4" style="text-align: right" title="<%: GetLocalResourceObject("Type") %>">
<%: GetLocalResourceObject("Type")%>
</div>
<div class="span-6 last">
<%: Ht...
I'm working on an ASP.NET MVC Multi Tenancy app.
Right now I managed to create dynamic subfolders, for instance some one registers with username "bob" and gets the following website:
domain.com/bob
My next goal is to provide subdomains: bob.domain.com instead of subfolders.
I found out that it's very complex to create dynamic subdoma...
I would like to use DataAnnotations for basic client and server-side validation of my MVC ViewModels. My ViewModel looks like this:
public class MyViewModel
{
public Client Client1 { get; set; }
public Client Client2 { get; set; }
public Product Product { get; set; }
}
So I would like to check that both client objects have...
In my Global.asax file I have the following;
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{cont...
My code:
[HttpPost]
public JsonResult DoBlah()
{
..
return Json(mySerializedObject);
}
In firebug, I can see the response content type is using application/json.
But for some reason, I get a popup with the json response.
What could the issue be here?
...
Hi there,
I have a page that functions correctly but when i issue a deny user for the whole site it redirects me to the logon page which seems to work BUT the css is not working. Hence there is no styling..
Can anyone help? My web.config is like so
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</a...
I have defined an object type in .NET that I want receive in a List<> as the input to an ASP.NET MVC action method?
Here is the action method and class I'm trying to receive.
public class WhereClause
{
public string ColumnInformation { get; set; }
public string WhereValue { get; set; }
public string AndOr {...
i have some header tabs on a basic index.aspx page that uses a masterpage.
the header tabs are correctly rendered on the index page from a viewusercontrol (<% Html.RenderPartial("pvHeaderTabs")%>). the problem is i am trying to load other partial views into the index page without any luck. can someone point out what i am doing wrong?
...
Hi All,
Trying to create a strongly typed master page with multi level navigation and would love to hear your opinion.
i'm using the sample recommended by MS here:
http://www.asp.net/mvc/tutorials/passing-data-to-view-master-pages-vb
so i have an ApplicationController that gets all the categories and all the other controller inherits ...
Hi,
I am using ASP.NET MVC application. However I am not able to understand the fact that in ASP.NET MVC pages are not posted/no postbacks. How is that possible? Unless posting the data how can the MVC framework manipulate the posted data. So what is the point in telling ASP.NET MVC does not have post backs. And also what the REST princi...
I have an asp.net MVC application that has one section /admin locked down via windows authentication. I have achieved this by doing the following.
Web.Config
<authentication mode="Windows" />
AdminController
[Authorize]
public class ContactController : Controller
{
....
}
This works as it should. When I try to access the /admi...
Hi,
I am working on a plugin system for Asp.net MVC 2. I have a dll containing controllers and views as embedded resources.
I scan the plugin dlls for controller using StructureMap and I then can pull them out and instantiate them when requested. This works fine. I then have a VirtualPathProvider which I adapted from this post
public...