I'm wondering if anyone has attempted to write an extension helper to the LabelExtensions.LabelFor HtmlHelper in MVC2? This would be useful for me in that my app requires that I always wrap labels in a <td> tag with a class attribute. Rather than have that code repeated in the View I thought I could write a little extension method:
publ...
For example, if I wanted to change the UpdateTarget or the InsertionMode in the controller after the form was posted.
...
I'm new to ASP.NET MVC, but I need to perform a search for articles that match a selected category. The results of this query need to be written into a "search results" div overlay with DHTML- jquery, probably.
So, I need the results of an Action, but not to render a view. I was thinking I could use Json and then iterate over the res...
I'm trying to create an XML file to conform to Indeed.com's Job Listing XML.
It looks like:
<?xml version="1.0" encoding="utf-8"?>
<source>
<publisher>Super X Job Site</publisher>
<publisherurl>http://www.superxjobsite.com</publisherurl>
<job>
<title><![CDATA[Sales Executive]]></title>
<date><...
I have an ASP.NET MVC application where I am editing an existing database to update a paticular field, DateTime. My database has 4 fields, two of which are DateCreated and DateModified. When I try to update the field, I want to keep DateCreated time the same, no reason to update the date it was created, and I change the DateModified time...
I am interested what are possible reasons that ASP.NET MVC 2 will have its own client-side validation instead of merging with xVal validation framework? Has someone from ASP.NET MVC team blogged about it?
...
I want to test the OnException, OnActionExecuted event of an MVC controller.
If I use mock like this:
var httpContext = MockRepository.GenerateMock<HttpContextBase>();
var request = MockRepository.GenerateMock<HttpRequestBase>();
httpContext.Expect(c => c.Request).Return(request).Repeat.AtLeastOnce();
r...
Hi I have an action in my controller, i am waiting to ModelBinder bind the incoming postdata to my action parameter but it doesnt do this, i dont know. I only manually bind them with TryUpdateModel() but i dont want to use it. Property names and the postdata are the same why it cant bind them ?
public class User
{
public string Fir...
i have an asp.net mvc application, and i use data annotations for data validations
something like this:
public class Booking
{
[Required(ErrorMessage = "Please enter your name")]
public string Name { get; set; }
...
so this is in my DomainModel and i need to translate the ErrorMessage, and to use the translation in my v...
Hello. I have implemented errors handling in ASP.NET MVC site in a way like suggests this post: http://stackoverflow.com/questions/619895/how-can-i-properly-handle-404s-in-asp-net-mvc/620559#620559.
With 404 errors all works fine. But how correctly show user friendly screen for 401 error? They usually do not throw Exception that can be ...
I want to solve duplicate objects in dynamic loading content. Please look at the following source code for easier understand.
Base Page HTML With 1 Dynamic Loading Content
<body>
<div id="general-div"></div>>
<div id="div1"></div>
<div id="placeholder1">
Dynamic Content will be placed inside this.
<...
Hi,
Is it possible to declaratively set clientCaching for an Action using the web.config in IIS7.
We need to set an expiry value of 1 day for our Home/Index Action. As of now we are doing this using a filter attribute. Is it possible to accomplish the same declaratively?
We are able to do it for static content, but not for Action Method...
Main question:
Why use custom localization helpers if there is something built-in doing the same already?
Long story
Currently I have been reading many options to localize your asp.net mvc website. Most of the posts are old, from oktober 22 2008 for instance.
I think one of the most linked option is the following: Matt Hawley on eW...
the basic idea is that you have some class that has a reference type property, something like this
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public Country HomeCountry { get; set; }
}
public class Country
{
public int Id { get; set; }
public string Name { get; set; }
}
now if ...
Hi, how can i automatically update my entity objects changed values and save them to db.
I hava an Action like that
public ActionResult Update()
{
User userToUpdate = new User();
TryUpdateModel<User>(userToUpdate,ValueProvider);
BaseRepository.Context.AttachTo("User",userToUpdate);
BaseRepository.Context.Sa...
I have an IActionFilter that does something in OnActionExecuted, however I don't want to perform this action when the controller result performs a redirect.
My initial thought was to check the type of the ActionResult as either RedirectResult or RedirectToRouteResult, but this isn't reliable as any type of result can perform a redirect ...
The problem i see with this code, is that it's going to be reused a lot; anything being edited/created by a authenticated user (except for Site administrators) will only have access to a their "studios" objects.
My question to you all; how would you re-factor this so the service layer can be abstracted away from the knowledge of the cl...
Situation: In some project management software written in asp.net I have a create project page (working fine). I need to add to this the ability to add tasks from a list of templates to this project pre-creation BUT the list of available tasks is dependent on some values sitting in the create form.
My abstract solution is this:
I h...
Hello Gurus,
I'm working on a asp.net mvc project that will use MS Windows Workflow Foundation to manage client business work flows. These are long running workflows spanning in time over a year or two. So we've decided to use State Machine workflows. A workflow instance will be persisted to a database when not being used (or in idle...
Hey All,
I have a partial view that contains an img like so:
<img src="" alt="test" id="chartImage" style="display: none;" />
And then in my view that contains it my javascript looks like this:
if ($(this).val() != '') {
setTimeout(function() {
$('#chartImage').attr("style", "")
...