Let me say I have a route/action for showing content pages like this:
/Page/{slug}
where {slug} can be anything that a visitor types in but if left empty it defaults to "Default".
I have my route definition handle the case where {slug} is empty or Default or anything else, so that is setup fine.
Now, what do you do in those cases wh...
Is there somewhere somebody who did a mapping of the c# dateFormat to the datePicker dateFormat, since I already know the C# dateFormat, I don't want to have to check the datepicker documentation everytime I have to build a custom date Format.
for exmple, i want to be able to specify in my helper dateFormat of 'dd/MM/yy'(c#) and it woul...
I have ajax code for asp.net (non-mvc) to call to a webMethod to get additional data from the server for a request. But I can't seem to figure out the url to give my JQuery in MVC.
<script type="text/javascript" language="javascript">
function SubmitAjax(url, message, successFunc, errorFunc) {
$.ajax({
type:"POST",
u...
I want to format the title of my ValidationSummary using a string something like:
"There are {0} errors on this page."
How do I find out the number of errors without doing it in the controller and adding it to ViewData?
...
I have setup our project with Team City 5.0 for continuous Integration. It works fine, but I had to change our VS 2008 .csproject file to allow our views to get complied correctly. I have read the following guide. link text. It takes about 3 minutes to build on our desktop and with the CI server! I am looking for a way to speed up our bu...
Hi all,
I've inherited the following code and i was wondering if i could pick at your brains to see if there's a nicer way to do duplicate this.
Heres the html for most of our partial input views
<% if (Html.IsInputReadOnly()) { %>
<td>
Id
</td>
<td>
<%= Html.TextBox(
"Id"
, (Model == null ? null : Model.Id)
, new { @read...
I'm currently testing my application and am stuck on trying to figure out how to create a custom fake URL referrer. I've tried to hard code it, but am getting an error that it is read-only. Here is what I've tried so far:
fakeController.HttpContext.Request.UrlReferrer.AbsolutePath = "http://www.yahoo.com";
as well as,
fakeControlle...
I was reading this blog post on ASP.NET MVC 2's new model validation and found it to be pretty cool. I see the value in keeping things DRY by adding a couple attributes to a class property and then automagically getting client and server side validation (as long as your controller checks for valid models).
That said, imagine an ASP.NET...
It's a little unclear for me on when to use a custom helper method and when to use RenderAction and also when to simply use ViewData instead. Some of their functions overlap slightly.
For example, if I were to create a Category navigation bar, would I create a new helper method and place that in some partial view? I had initially though...
I have implemented CKEditor via an EditorTemplate called wysiwyg.ascx
Everything loads fine in edit view, when I attempt to save the model back to the database via POST Edit ActionResult in the controller. the property that uses the wysiwyg comes back null. I am not sure how to solve this.
...
Hi,
I been building my first ASP.NET MVC application and so far am getting to grips quite well with it I think. Some of the concepts are still fuzzy (routing) but I have an idea.
One of the things we do with our WebForms apps is to route navigation through an Application Controller [Fowler] to handle our page navigation based on the cu...
Hi
I have an MVC website, and it is running on IIS6. Since i have not access to the webserver, i use the .aspx extension (in global.asax). I have a controller called "Quiz" and all of their methods marked with an authAttribute. When the user is not authorized, it should redirect to "/Account.aspx/Logon?ReturnUrl=Test.aspx", but i get a ...
I'm considering utilizing the ASP.NET Membership Provider for a few different web apps/tools with a single login approach.
REQUIREMENTS
User logs in to my.domain.com and sees a list of apps/tools that they have permission to use. The user selects the tool they'd like to use and clicks the link. When the tool opens, it is able to i...
hi there.
im using data annotation with buddy classes for error etc
however i have a field for photo on the view it should be an image
but on the edit and add it should be a file upload ???
but UIHint will only let me have one, so how do you have multiple UI
for one type in your class?
thanks
...
Has anyone had to deal with multiple AntiForgeryTokens on a child view of a master page? The scenario I am thinking about is as follows:
The view contains a Form with an AntiForgeryToken rendered as a hidden field.
The view is contained by a master page that has another AJAX submitted form.
The issue here is that I need to encapsula...
<%= Html.ActionLink(Html.Encode("user3"),
"Filter", new { controller = "Search",
userName = "user3",
dateFrom = DateTime.Now.AddDays(-2).ToString(),
dateTo = DateTime.Now.ToString() })%>
It's evaluated to this link:
http://localhost:60357/Search/Filter?userName=user3&dateFrom=08.02.2010%2023%3A21%3A33&dateTo=10.02...
I want my autocomplete to be very user friendly.
I have products that people will search for by:
part#
manufacturer
e.g. searches
HND123
Honda 123
So basically each manufacturer has a short form and a long form.
How should I build my search index so when the autocomplete needs to fetch the data from the db, it will return result...
Hello All,
On a project I'm building for a client, one of the requirements is advanced user tracking. The client would like to know what pages an authenticated user is visiting, and when. I read through this post, which is probably the method I will go with. However, that seems a bit tolling on the database, and being that the client...
In my ASP.NET MVC2 application, I have a ViewModel class called UserCreateViewModel.
In this class, there are a number of properties that directly map to a LINQ-to-SQL class, called User. I'm using AutoMapper to perform this mapping and it works fine.
In my Create action of the UserController, I receive a partially complete UserCreateV...
I am working on a multilingual website where the URL will contain the language code:
/en/Home
/es/Home
Whenever someone enters a url that does not have the language code at the beginning (/Home), I would like to do a 301 redirect to the url (route) they entered but append the language code at the beginning. I will determine the langua...