asp.net-mvc

NHibernate one-to-many delete

I am working on an ASP.NET MVC application using NHibernate as the ORM. I have two domain objects: public class Contact { public int ID { get; set } public string Name { get;set; } public IList<ContactNumber> ContactNumbers { get; set; } } public class ContactNumber { p...

Spring.Net: Inject ApplicationContext / ObjectFactory itself

Hi Is there a way to pass the IObjectFactory or the ApplicationContext that is currently executing as dependency to an object? For example <object id="SpringActionInvoker" type="xxx.SpringActionInvoker, xxx"> <constructor-arg ref="reference_to_the_ApplicationContext_or_ObjectFactor_that_is_executing" /> </object> I want to us...

ASP.NET MVC - Overriding an action with differing parameters.

I have a controller that inherits from a base controller. Both have an edit (post) action which take two arguments: On Base controller: [HttpPost] public virtual ActionResult Edit(IdType id, FormCollection form) And in the derived controller: [HttpPost] public ActionResult Edit(int id, SomeViewModel viewModel) If I leave it like ...

livequery not always live when used with jquery.validate

I use jquerylive plugin to add additional css classes to .field-validation-error class like this: $(".field-validation-error").livequery(function () { $(this).addClass('ui-state-error ui-corner-all'); }); when I get some spans with this class generated by jquery.validate the above code works, but at 2nd validation it doesn't. h...

C# mvc2 encode url

i'm trying to encode an url with the code below; var encodedUrl = HttpUtility.UrlEncode("http://www.example.com"); var decodedUrl = HttpUtility.UrlDecode("http%3A%2F%2Fwww%2Eexample%2Ecom%2F"); I'm working with the google webmaster tools api and this api expects an URL as shown in the decodedUrl variable above. Every single character ...

how to upload System.Web.MVC.dll from bin in iis7?

working with iis7. project is in Integrated Pipelinemodus Application Pool is : DefaultAppPool have System.Web.Mvc.dll, System.Web.Routing.dll, System.Web.Abstraction.dll in bin folder of project. i cant run aspx pages, becouse i need to configurate something in iis7 to use dll from bin folder. please help p.s. seems like it has to ...

How can I set the value of this cookie property from code behind?

I would like to do this: Dim str As String = class.isGuest("yes") but it won't work. Public Property IsGuest(ByVal guestStatus As String) As String Get Dim guestCookie As New HttpCookie("g") For Each key As String In Context.Response.Cookies.Keys If key = MYACCOUNT_SESSION_COOKIE_NAME Then ...

How to send parameter in query string on ajax call in asp.net mvc

I want to send the selected page value on the querystring while navigating through paging. The URL that is generated for paging is like this: Link/Index?page=2 Link/Index?page=3 But on my URL it only shows Link/Index and performs the Ajax call. But if I disable my Javascript and then navigate through paging it gets Postback and has ...

Why can't I get the MvcHttpHandler to handle my .mvc requests?

I have a project using Asp.Net 3.5 and MVC 1. Everything runs perfectly on my local IIS, but not after I deployed it to the hosted server. The web server is IIS7 with integrated pipeline activated (according to the hosting company). When I go to the root of the web site, www.site.com, the default.aspx makes a redirect to a controller ...

ASP.NET MVC Form post

I'm a beginner in ASP.NET MVC application. What I'm trying to do is creating a form with some inputs that the user will be filling up, and once the user click the post button, I want the form to be posted with the information filled up and ready for printing. The way I'm doing it right now is as follow: // the controller that returns th...

ASP.Net MVC: Where to store Application and Admin Panel settings? Web.config?

Having built myself a decent website using ASP.NET MVC, I'm about to build an "Admin Panel" for users in the "Admin" Role to control the website with. Specifically, the website that I've built is an internal site for an enterprise and it consists of a bunch of mini web-apps, each of which need to be configured and/or tweaked from time to...

Linq to SQL Data Concurrency - Is it safe to use only PKs?

I am getting an error in my MVC-based website surrounding data concurrency in Linq to SQL: "Row Not Found Or Changed" After reading several posts on here it seems as though an accepted solution is to set all non-Primary key fields to UpdateCheck = false in the dbml designer. Before taking the plunge with this, I wanted to ask, will I ...

Spark views work initially, but then get a "Dynamic view compilation failed" error after 30 minutes or so.

After pushing my asp.net mvc (with spark view engine) project to our live server yesterday I've started getting a strange error. Everything works fine initially, but after some time (maybe 30 minutes) the views start throwing "Dynamic view compilation failed" errors and complaining about namespaces not existing. The assemblies for the na...

Storing/Calling Repeating Code blocks in MVC

Hey all, Sorry its me again. This time I have a question that I think is fairly general. I am using code that is almost exactly the same over and over again within a controller to set up a viewModel. My question was, is there a way to store this code somewhere within the MVC project, possibly have it return a viewModel, and call it...

MVC.NET 404 outside of Domain

I am trying to get a demo site for a client setup. This is the 1st application my company is doing in MVC.NET, so I get to experience all the new things to find out (and all the headaches it'll cause). Anyway, the site works fine locally (localhost) and on the server inside our domain. External users not on the domain however, only ge...

Where can I find documentation on MvcScaffold package listed on nuPack?

I'm trying to find documentation on how to use the MvcScaffold package on nuPack, but I can't find anything anywhere. I know I have basic intellisense support in the Package Management Console, but I want to do something a little more complicated than your typical scaffolding. I was hoping there would be some documentation somewhere. ...

how do i reference an image from my css in asp.net-mvc on a hosting provider

i have this inside my site.css file (in the COntent directory) body { width: 100%; background: #e7e6de url("/content/images/back-page1.png") repeat-x; font: normal 13px arial, sans-serif; text-align: center; color: #4c4c4c; } it works fine when i test it locally but it doesn't work when i upload the site to the hosting provider. the ...

WIth this Code I am getting IE page load error on the Left hand bottom of the screen..

Hello Friens, I have this code in my view.. <div> <input type="button" value="Cancel" id="btnCancel" onclick="window.location.href='../Reviewer'" />&nbsp;<input type="submit" value="Save" id="btnSave" onclick="saveCreateHeader()"/><input type="button" style="margin-left:50px;" id="btnNextStep" value="Next Step" onclick="window.locat...

ajax.actionlink and disabling the link onSuccess in MVC 2

Hello, I have a scenario where the ajax actionlink text is 'Apply'..On clicking this and calling an action, i want the link to be disabled and to be changed to 'Application successful'. How can i do this? Thanks ...

Authentication pattern for a web API exposed to an iPhone app

Hi -I need to expose a web API to an iPhone app. Users will connect with Facebook (no "proprietary" user accounts, all Facebook based). Some methods will require authentication and others won't. When users connect to Facebook from the iPhone app, the app keeps an authentication (session) cookie. My first thought is to use Windows Forms ...