Is it possible to use the new client side validation features of asp.net MVC 2 without having to use the MS scripts (MicrosoftAjax.js, MicrosoftMvcAjax.js, MicrosoftMvcValidation.js)?
I use JQuery throughout my application; JQuery has a great plugin for validation and I don't really want to force my users to load MS scripts just for v...
Can somebody please suggest how I could write a Unit Test with Moq for following HtmlHelper method?
public static HtmlTagBase GenerateTag<T>(this HtmlHelper htmlHelper
, object elementData
, object attributes)
where T : HtmlTagBase
{
return (T)Activator.Creat...
I have a master page in my asp.net MVC project, which has code like this:
<div id="menu">
<ul>
<li><a href="#" class="current">home</a></li>
<li><a href="#">add image</a></li>
<li><a href="#">contact</a></li>
</ul>
</div>
Depending on what page I am on, I'd like to move the c...
I have a CSS stylesheet defined in the Master Page of my project. On one of the pages/views that inherits from the Master Page, I need to add another CSS stylesheet (I could also add it inline, though I'd rather not).
However, how to do this escapes me. Is this even possible?
...
So Html.ActionLink("Report", "SendMail", "Misc", new { id = Model.ImageID }, null) will generate a nicely formatted link.
<a href="http://localhost:3224/Misc/SendMail/5">Send Mail</a>
How can I generate just the URL of the link, short of parsing the output of Html.ActionLink?
...
Is it possible to have security in ASP.NET MVC configurable at runtime? For example, if I have a controller that has been marked as
[Authorize(Roles="Admin")]
Is there a way to add/remove roles at runtime? Or, do you have to change it in code and re-compile?
...
I have a master page which references a style in the following manner:
<link rel="stylesheet" type="text/css" href="../../Content/Style.css" />
All my pages inherit from this master page. And this works well when the URL is http://www.domain.com/home/details/5, however the URL is http://www.domain.com/home/create, then, of course, St...
In a regular Web Forms application, I could upload the files to a web server and just open the web server in Visual Web Developer and it worked great, but because MVC is a project and not a web application, I can't just upload the files regulary and still open it in Visual Web Developre normally...
So here comes the SVN, but the pro...
I try to create some method that can update any changed data from changed Data object (this object is generated by ASP.NET MVC) to old Data object (this object is retrieved from current data in DBMS) like the following code.
public static bool UpdateSomeData(SomeEntities context, SomeModelType changedData)
{
var oldData = GetSomeMod...
I built an ajax chat in one of my mvc website. everything is working fine. I am using polling. At certain interval i am using $.post to get the messages from the db. But there is a problem. The message retrieved using $.post keeps on repeating. here is my javascript code and controller method.
var t;
function GetMessage...
What is your preferred way to handle hits to files that does not exist on your MVC app.
I have couple of web apps runing with MVC and they are constantly getting hits for files folders etc. that does not exist in the app structure.
Apps are throwing exception: The controller for path could not be found or it does not implement IControl...
Hello,
My problem is the following:
I'm using client validation function of the MVC 2.0 framework.
Everything is nice, when I use the validation in a simple form.
But when I use an Ajax form, and I update the fields of the ajax form, the client validation doesn't work.
I think about, I have to refresh the validation after the ajax c...
Hi,
Just starting with ASP.Net MVC and have hit a bit of a snag regarding validation messages.
I've a custom validation attribute assigned to my class validate several properties on my model.
When this validation fails, we'd like the error message to contain XHTML mark-up, including a link to help page, (this was done in the original W...
In the method CreateView() (check my View Engine below) or in my custom action filter (also below) I have to somehow check if the View we are requesting is a ViewUserControl. Because otherwise I get an error saying
"A master name cannot be specified when the view is a ViewUserControl."
when I have "modal=true" in QueryString and the Vi...
I am evaluating db4o for persistence for a ASP .NET MVC project.
I am wondering how I should use the IObjectContainer in a web context with regards to object lifetime. As I see it, I can do one of the following:
Create the IObjectContainer at application startup and keep the same instance for the entire application lifetime.
Create on...
I've already started similar topic, but still didn't find final solution...
So here I am with new one :) ... I'm developing NerdDinner from scratch and now I came to point where I define DinnerViewModel.
Following these instructions (starting from Listing 5) I came to this:
namespace Nerd.Controllers
{
// View Model Classes
...
Im trying to create a custom version of the RequiredAttribute to replace the built in one and I've got it working for properties that have strings values, but with properties that are DateTime or integer for example, the default RequiredAttribute seems to be applied automatically (IF the property is not nullable!)
My problem is that i w...
If you look at the NerdDinner example of creating and editing dinners then you see they use a partial (ViewUserControl or ASCX) DinnerForm to put the functionality of creating and editing dinners into one file because it is essential the same and they use it using RenderPartial("DinnerForm").
This approach seems fine for me but I've run...
It makes sense to pass a filter object to the repository so it can limit what records return:
var myFilterObject = myFilterFactory.GetBlank();
myFilterObject.AddFilter( new Filter { "transmission", "eq", "Automatic"} );
var myCars = myRepository.GetCars(myfilterObject);
Key question: how would you implement paging and where? Any link...
Say you have a few DropDownLists that filter data:
Car Make: [Ford,Chevrolet,etc]
Car Year: [2010, 2009, 2008, etc]
Car Model: [LT, SLT, etc]
And you make a selection and not show that DDL again. Is there any standard place to maintain previously selected values? This is for a "drill down" menu system.
...