asp.net-mvc

castle PerRequestLifestyle not recognize

Hi all, New to Castle/Windsor, please bear with me. I am currently using the framework System.Web.Mvc.Extensibility and in its start up code, it registered HttpContextBase like the following: container.Register(Component.For<HttpContextBase>().LifeStyle.Transient.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current))); ...

Unit Testing UrlHelper Extension Methods

I'm trying to create unit tests to make sure my extension methods for UrlHelper work? Does anyone know how to do this? I'm using MVC 1.0 and MvcContrib. I can test the routes but can't test code like this: public static string MoreFloorplans(this UrlHelper urlHelper, long productID, int pageIndex) { return urlHelper.Acti...

Is POSTing a Dictionary to an .NET MVC action possible?

I have a form which contains a series of fields like: <input type="text" name="User[123]" value="Alice" /> <input type="text" name="User[456]" value="Bob" /> ... Where the index of the User array (123 and 456) are ID's associated with the value. I'm trying to update these values in the controller. My thinking is that a Dictionary that...

Windsor + NHibernate + ISession + MVC

Hi I am trying to get Windsor to give me an instance ISession for each request, which should be injected into all the repositories Here is my container setup container.AddFacility<FactorySupportFacility>().Register( Component.For<ISessionFactory>().Instance(NHibernateHelper.GetSessionFactory()).LifeStyle.Singleton, Component.F...

ASP.NET MVC: Can't figure out what VirtualPath is?

I have a View that displays a list of images and i am now trying to get it to display the images as thumbnails. Well, i'm pretty sure i got most of it right using VirtualPath's from a custom ActionResult although i can't seem to figure out what it is making the VirtualPath url?? BTW, i'm using XML to store the data from the images inst...

Is there any way to manipulate variables passed in to a child class constructor before passing it off to the base class?

Hi, Is there any way to delay calling a superclass constructor so you can manipulate the variables first? Eg. public class ParentClass { private int someVar; public ParentClass(int someVar) { this.someVar = someVar; } } public class ChildClass : ParentClass { public ChildClass(int someVar) : base(someVar) ...

asp.net MVC user management module

Hi I want to make user management module for a cms in asp.net MVC and needs layouts for that.Anybody help me... Thanks ...

IIS7.5 and MVC 2 : Implementing HTTP(S) security

This is my first ASP.NET MVC application, and my first on an IIS 7.x installation whereby I have to do anything over and above the standard. I need to enforce Windows authentication on the /Index and /feeds/xxx.svc pages/services. In ASP.NET Web Forms, I would apply the Windows permissions on the files and remove Anonymous authenticatio...

ASP.NET MVC: customized design per domain

Hi. I'm thinking about ASP.NET MVC 2 project which should display the same Domain Model(with different data) in different mark-up or page design(selected by url domain). I'm not sure which one ot these to use : set of views per unique domain + one default? use areas? any other idea? How would you do that? Thank you. EDIT I have f...

listbox with checkboxes

Greetings, in my asp.net mvc application I have a listbox rendered as follows: <%= Html.ListBox("localization", (Model as SeekWeb.Models.CreateMessageViewModel).Localizations.AsEnumerable())%> is there any way to have checkbox for each listbox item? if checkbox is checked then the appropriate listbox item is selected. ...

Linq to SQl over WCF Timesout after several calls

I have a L2S Repository class which instantiates the L2S DataContext in its constructor. The repository is instantiated at run time (using Unity) in a service hosted in IIS with WCF. When I run up the client MVC applicaton the calls to the backend WCF service work for a while and then timeout. I suspected perhaps a database issue as I...

How does Asp.Net MVC compare to Java MVC frameworks

I've started my career as a Java developer, then moved to Asp.NET and recently to the Asp.Net MVC, which I like a lot. When developing in Java I used Struts1, which I remember as a hideous framework with loads of XML. Now I suspect that Java MVC frameworks have moved on from the Struts times. So how do modern Java MVC frameworks compare ...

Get records which not starts with alphabet in linq

I need to get the list of records that does not starts with alphabets. i.e. Which starts with numeric and any special character. I am using asp.net mvc (C#) for my application. Whats the simple linq query to get this list? ...

MVC Site - Ensuring the default entry view is always correct

I have a MVC site with AD authorization. This is all working fine. I publish the site to the webserver and call the site directly (http://intranet). If I have not logged in for a while (I have an authorised cookie with a 30 minute TTL), I am prompted to log-in and if successful I am redirected to the homeController's index view. This...

ASP.NET MVC Html.DropDownListFor Select value

Hi, I have a little problem. I use the Html.DropDownListFor helper to render a dropdown list to the client. But I can't set the selected value in dropdown list. <%= Html.DropDownListFor(model => Model.CalculationClassCollection, new SelectList(Model.CalculationClassCollection, "ID", "Name", 3 ), new { id = "ddCalculationClass" })%> ...

Add own search parameter in jqGrid in Asp.net mvc

I have just started working on asp.net mvc and jqgrid. I have a calendar which returns a date, a multiselect list box and apply filter button outside of the grid. Is there a way to pass these filter values to the server-side actionresult GridData() based on the selected date and multiple selected values and also it persist while pagin...

ASP MVC Ordering Records By Date in a View?

Hi guys, I am outputting a students logged problems by passing the student into the view and then accessing their problems like this: foreach (var item in Model.Student.Problems) { I was wandering how I could sort these items by the ProblemDateTime attribute? I notice when I put a . after Problems there is a OrderByDescending option ...

Preventing cross-site scripting in ASP.NET MVC - using jQuery or standard HtmlHelpers

I am building an ASP.NET MVC application that is AJAX-driven. For some reason I need to add some DOM elements on the fly when clicking a submit button. This is accomplished with jQuery.append(). One element inserted is a textarea, whose the data must be parse before submitting to ensure that no cross-site scripting can be done. We know...

how to block certain ip's (users) to access my website ?

anybody knows of blocking certain users (by IP) from accessing your website (website on asp.net mvc). EDIT: I know that web-servers can do this as well, but I need this at the application level ...

Client Side validation in Telerik's MVC Grid

Is it possible to add client side validation to the fields of the Telerik MVC Grid at runtime. I am having validation JSON strings stored in the DB which I need to use when inserting or updating content ...