Maybe this question is quite simple because I'm new to MVC2. I have a simple demo MVC project.
(1) A weak-typed view: Index.aspx
<% Html.RenderPartial("ArticalList", ViewData["AllArticals"] as List<Artical>); %>
(2) A strong-typed partial view: ArticalList.ascx
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<...
[MetadataType(typeof(Deal_Validation))]
public partial class Deal
{
}
public class Deal_Validation
{
[Required]
public string Title { get; set; }
public double? EstValue { set; get; }
}
How to validate EstValue (check if it is of type double?)
Thanks
...
Which regular expression can I use to match (allow) any kind of letter from any language
I need to match any letter including any diacritics (e.g. á, ü, ñ, etc.)
and exlude any kind of symbol (math symbols, currency signs, dingbats, box-drawing characters, etc.) and punctuation characters.
I'm using asp.net MVC 2 with .net 4. I've trie...
Does ASP.NET MVC offer any simple way to get model binding to work when you have model classes that inherit from others?
In my scenario I have a View that is strongly typed to List<Person>.
I have a couple of classes that inherit from Person, namely PersonTypeOne and PersonTypeTwo.
I have three strongly typed partial views with names ...
I'm building a basic blog application just now, for viewing data I'm just using the default route, i.e. -
routes.MapRoute
(
"Default", // Route name
"{controller}/{action}/{id}",
new { controller = "Blog", action = "Index", id = UrlParameter.Optional }
);
So that when you go to mysite.com/View/12 it displays the blog ...
I'm having problem with client side validation on a View that renders a dropdownlist with help of a Html.RenderAction.
I have two controllers. SpecieController and CatchController and I've created ViewModels for my views.
I want to keep it as DRY as possible and I will most probably need a DropDownList for all Specie elsewhere in the n...
Hi all I wanted to allow the users to enter html and links in textbox. How can I achieve something like this in ASP.NET MVC 2? I have something like this now...
<div class="editor-field">
<%= Html.TextAreaFor(model => model.Description) %>
<%= Html.ValidationMessageFor(model => model.Description) %>
</di...
I am migrating a web app in mvc1 to mvc2. When it came down to migrating my MembershipProvider authentication I keep getting errors that MembershipProvider and MembershipCreateStatus type cannot be found. I do have the reference to System.Web which to my understanding includes the Security reference, but when I examine the the object, th...
I've the following code:
<% using (Html.BeginForm("Update", "SkillLevel", FormMethod.Post, new { id = "TheForm" }))
{ %>
<div id="demo3" class="demo">
<ul>
<li id="shtml_1">
<a href="#">Root node 1</a>
<ul>
<li id="shtml_2">
<a href="...
Lets say I want my Admin (area) to run on HTTPS
and the default site runs on HTTP.
Is this possible? How?
...
With jQuery, is it possible to call /ControllerName/GetSomething?parameter=test, while in GetSomething method I have following:
public ActionResult Details()
{
filterQuery.OrderBy = Request.QueryString["parameter"];
var contacts = contactRepository.FindAllContacts(filterQuery).ToList();
return View("ContactList");
}
and ...
I have a component that has a dependency on UrlHelper that I need to register using Castle Windsor. UrlHelper in turn has depdendencies on RequestContext (and RouteCollection).
Now my controller has a Url property of type UrlHelper but cannot really access this as far as I can tell.
What is the most efficient way to register my UrlHelp...
We're currently rewriting our organizations ASP.NET MVC application which has been written twice already. (Once MVC1, once MVC2). (Thank god it wasn't production ready and too mature back then).
This time, anyhow, it's going to be the real deal because we'll be implementing more and more features as time passes and the testruns with MVC...
I'm not sure if what I am try to do is possible but here goes.
I have a form with two drop down lists - category and subcategory. When a category is selected an AJAX call is made to get the list of subcategories. For demo purpose I've selected a category of 'Fruit' which shows all of the subcategories for this group.
<select id="catego...
Summary: DataAnnotation's automatic handling of an "int?" is making me rethink using them at all.
Maybe I'm missing something and an easy fix but I can't get DataAnnotations to cooperate. I have a public property with my own custom validation attribute:
[MustBeNumeric(ErrorMessage = "Must be a number")]
public int? Weight { get; set; }...
Hi all I am using the markitup editor to get the value for one of my fields and storing it a sql server 2008 db. Now I guess the problem is people having script tags and javascript in the editor and injecting malicious scripts and I have my validate input turned false. So can anyone suggest me a way to write a custom validation method th...
I have a site which has an area that requires authentication. Right now I use the roles attribute on all the controllers in that area, and I run a query to retrieve that users ID, and all their settings.
It seems like a code or design smell to me that I am retrieving the userid and settings each time a controller in that area loads up? ...
For some reason my application isn't routing to my controller method correctly. I have a routelink like this in my webpage -
<%= Html.RouteLink("View", "Blog", new { id=(item.BlogId), slug=(item.Slug) }) %>
In global.asax.cs I have the following routes -
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
...
Here are two sources for PayPal IPN:
Kona.Web IPN
DotNetNuke IPN
DNN has a loop in the beginning of the Page_Load method that captures txn_type and txn_id, which I don't see in the Kona code.
DNN also captures payer email and other information into local variables.
I am trying to make sure that I incorporate some of the security chec...
Hey all,
I'm trying my hand at creating a session which stores member information which the application can use to reveal certain navigation and allow access to certain pages and member role specific functionality.
I've been able to assign my MemberLoggedIn object to the session in this way:
//code excerpt start...
MemberLogg...