I have a strongly typed partial view CheckBox.ascx that renders a checkbox. This is used by another partial view that renders a list of checkboxes using CheckBox.ascx.
I am having problems figuring out how to use the Html.Label helper method to get labels working correctly, i.e. setting the label for property to be the id of the related...
I have a SearchViewModel with these properties:
[RegularExpression("name")]
public String SortField;
[RegularExpression("asc|desc")]
public String SortDirection;
As you can see, I want "name" to be the only valid value of SortField at this time, and "asc" or "desc" the only valid values for SortDirection.
However, Va...
Using jQuery Lightweight RichTextEditor plugin.
When I use a partial view (user control) on my page the textarea rendered retains input focus even though I'm explicitly setting focus on the page load (setting z-index doesn't work either):
$(document).ready(function () {
$("input:text:visible:first").focus();
});
In Vi...
I'm using MVC 2 and MVC Futures 2.0.50217.0.
I started with a view which repeatedly calls RenderAction(...) to include some external content implemented by another controller within my application. This is from the containing view:
<% foreach (var subModel in Model.SubModels) { %>
<h3><%: subModel.Title %></h3>
<% Html.RenderAc...
Hi,
Was wondering if there are any transactions support in asp.net for MVC 2? i.e. commit & rollback?
I have a few slightly risky db transacts which i'd prefer firmed up with transactions.
could the system transactions namespace be incorporated into a respository of db calls?
...
A friend wants to consume my ASP.NET MVC 2 application in a similar fashion as adding a web reference to it, accessing my functions, and using my model objects from a .Net web form from a separate website.
Any links out there that could explain how to "dress" my MVC responses so that his server to server consumption would be similar in ...
When developing in ASP.NET MVC I use a 1:1 ViewModel setup where the viewmodel contains only the data required by the view. I'm also using data annotations to validate on the viewmodel.
My concern is that this is not following the DRY principle as I find myself having to duplicate validation throughout my sites. I'd love to have validat...
I've created a few html helper methods for asp.net mvc that I would like to use between projects. Does anyone know of a way to put them in their own project file so I can include that in other solutions?
I've tried this but it doesn't seem to work. When I try to use the helper it complains that htmlHelper is not being set. It isn't nece...
I have spent several hours today reading up on doing Custom Routing in ASP.NET MVC. I can understand how to do any type of custom route if it expands from or is similar/smaller than the Default Route. However, I am trying figure out how to do a route similar to:
/Language/{LanguageID}/Question/{QuestionID}/
And what I would like, too,...
I have a form for creating a new account and it has a password field in it. I'm using view models to pass data to the controller action and back to the form view. When the user enters their details in, and clicks submit, if validation fails and it returns them to the same view passing back in the view model, it won't default the password...
I've decided to take the suggestion from Robert Harvey on this site and build an application using ASP.Net MVC.
When I went to Bing for a brief overview, I saw there was an MVC2.
What is the difference and should I care?
...
I've just converted a project from MVC1 to MVC2. In the MVC1 project the HTTP status code was being set in some of the views. These views are now generating this exception:
Server cannot set status after HTTP headers have been sent.
What has changed from MVC1 to MVC2 to cause this and is there any way to fix this?
...
I've been wondering how to properly set up many-to-many relationships in ASP.NET MVC 2 using Linq2Sql for quite some time now. I found this blog post that seems to have a similar model layout as mine.
If you take a look at the first screenshot showing the data model you can see that each model has "Navigation Properties" at the bottom ...
I have a class that extends the HtmlHelper in MVC and allows me to use the builder pattern to construct special output e.g.
<%=
Html.FieldBuilder<MyModel>(builder => {
builder.Field(model => model.PropertyOne);
builder.Field(model => model.PropertyTwo);
builder.Field(model => model.PropertyThree);
})
%>
...
My ASP.Net MVC 2 project references a Domain project where POCO business objects are defined and a Data project where EF 4 POCO persistence is implemented.
Things were running well until I had a little fussiness with my version control provider (rollback to previous version left me with merge conflicts). Now, upon launching the MVC 2 p...
Hi,
I am trying to use Jquerys getJSON method to return data server side to my browser, what happens is the url the getJSON method points to does get reached but upon the postback the result does not get returned to the browser for some odd reason. I wasen't sure if it was because I was using MVC 2.0 and jQuery 1.4.1 and it differs to t...
I am working on my first ASP.NET MVC 2.0 app and realized that I am still confused about the best way to manage views.
For debugging, I would like to quickly dump data from several model classes into one view. I created a viewmodel class that combines the data into a single object.
public class DBViewModel {
public IQuerya...
Hi,
I want to do some server side validation that is done on Action not in model (dataannatations).
if(ok)
//somecode
else
{
ModelState.AddModelError("", "Some error");
}
For that example I don't get any notification with validation summary. Even if I put property nam...
After I have the initial ASP.NET MVC 2 website and the default Membership provider up, how do I start adding features specific to an user? Like, say, we want to let users choose their favorite products and we want to remember these choices somehow or add a favorite color property to an user?
Where should these customizations go and how...
My project namespace is
MyProject.MVC
So my controllers, which are segregated into Areas, are in this namespace:
MyProject.MVC.Areas.AreaName
But when I try to access a controller action in this namespace, I get a 404 error:
http://MySite/AreaName/Action/View
If I "remove" the MVC portion from the namespace on my controllers, ev...