Here's the scenaio, I have an Employee object and a Company object which has a list of employees.
I have Company.aspx which inherits from ViewPage<Company>.
In Company.aspx I call
Html.DisplayFor(m => m.Employees).
I have an Employee.ascx partial view which inherits from ViewUserControl<Employee> in my DisplayTemplates folder.
Eve...
I am exploring Sharp Architecture and I would like to know how to
access the validation results after calling Entity.IsValid().
I have two scenarios e.g.
1) If the entity.IsValid() return false, I would like to add the
errors to ModelState.AddModelError() collection in my controller.
E.g. in the Northwind sample we have an EmployeesC...
foreach (var item in ((ModelBase)Model).Stylesheets)
{ %>
<%=item.url %>
<link rel="stylesheet" type="text/css" href="<%= Url.Content(item.url)%>" />
<% }
I've got the code above running but whenever it outputs the link tag I get the following.
../../Content/Site.css<link rel="stylesheet" type="text/css" href="Views/Shared/%3C%25=...
i have two options
One
<%= Html.CheckBox("postType", false, new { @id = item.int_PostTypeId.ToString() })%>
Second
<input type="checkbox" name="postType" value="<%= item.int_PostTypeId.ToString() %>
1st question:
what is differenct between these two method of check box declaration.
2nd question:
and how can we get value of chec...
How will I populate a ASP.NET MVC List box?
Make it non selectable?
how will i remove the selected items from the listbox
...
I have a private void function set for some validation. Should my validation fail, I would like to redirect to another ActionResult and kill the process for the ActionResult that was being used. Response.Redirect("controllerName") does not help. Any ideas?
[Accept(HttpVerbs.Post)]
public ActionResult NerdDinner(string Name)
{
test...
I need to validate the Advanced search form , but it has data to be sent to 2 different table people and documents so i am unable to use data annotations. I need to validate the Name to be characters only, account number & amount to be a number.How can i validate these fields?
<asp:Content ID="indexContent" ContentPlaceHolderID="MainC...
Is there a good way to make an HTML dropdown read only. Using disabled attribute of select seems to work, but the value is not posted.
<select disabled="disabled">
I have a complex page with lots of javascript and ajax. Some actions in the form cause to drop down to be read only some actions let user decide the value.
Edit: Is there ...
I can understand what the error is saying - it can't compare a list. Not a problem, other than the fact that I don't know how to not have it compare a list when I want to page through a model with a list as a property.
My Model:
Event : IEvent
int Id
string Title
// Other stuff..
LazyList<EventDate> Dates // The "problem" prop...
I am wanting to pass something like the following to my view from my controller via GET not POST:
public class MyDTO
{
public string val1 { get; set; }
public string val2 { get; set; }
public MyObject obj { get; set; }
}
public class MyObject
{
public int SomeInt { get; set; }
public string ACoolValue { get; set; }
pu...
Hello,
I'm testing some concepts in ASP.NET MVC multisteps (Style Wizards) with a small application which allow me to records organizations in a database.
To make things easier, I've a class OrganizationFormModelView that contains an object of class Organization and a property called ParentOrgList of SelectList type. The only purpose o...
I’m trying to produce a view to show a list of users and their role using the built in membership provider.
My model and controller are picking up the users and roles but I’m having trouble displaying them in my view.
Model
public class AdminViewModel
{
public MembershipUserCollection Users { get; set; }
public str...
Per the above I am trying to re-target a fresh ASP.NET MVC 2 application in Visual Studio 2010 RTM.
After all sorts of tweaking the closest I am getting is the error below:
The primary reference "System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved beca...
I got this error using a new "ASP.NET MVC 2 Empty Web Application" project:
CS0012: The type
'System.Web.Routing.RouteValueDictionary'
is defined in an assembly that is not
referenced. You must add a reference
to assembly 'System.Web.Routing,
Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
...
ASP.NET MVC has good support for role-based security, but the usage of strings as role names is maddening, simply because they cannot be strongly-typed as enumerations.
For example, I have an "Admin" role in my app. The "Admin" string will now exist in the Authorize attribute of my action, in my master page (for hiding a tab), in my da...
Hi experts,
I am working on a website similar to nerddinner. Is it possible to perform similar join
using Linq to entities what is done with linq to sql in nerddinner.
I am posting the codes below.
public IQueryable<Dinner> FindByLocation(float latitude, float longitude) {
var dinners = from dinner in FindUpcomingDinners()
...
first I want to say that I hope this doesn't look like I am lazy but I have some trouble understanding a piece of code from the following project.
http://kigg.codeplex.com/
I was going through the source code and I noticed something that would be usefull for my own little project I am making. In their BaseController they have the follo...
This query works fine:
DetachedCriteria filter = DetachedCriteria
.For(typeof(NotificationRecord), "nr")
.Add(Expression.Eq("nr.Submission.Id", 5));
return ActiveRecordMediator<NotificationRecord>.FindAll(filter);
This query fails with the exception message: could not resolve proper...
Hi guys,
I'm using ASP.NET MVC 1.0 and I try to create a personal blog!
I have a problem with an url that it has to show all post wrote in a specific year and specific month.
My url is look like(http://localhost:2282/Blog/Archive/2010/5).
So... it work correctly, infact it show all record that have year=2010 and month=5 but my problem...
I'am using asp.net mvc version 1.0 and I've a problem with some parameter in a url!
My url is look like so(http://localhost:2282/Tags/PostList/c#)
routes.MapRoute(
"TagsRoute",
"Tags/PostList/{tag}",
new { controller="Tags",Action="PostList",tag = "" }
);
In effect the problem is that tag para...