asp.net-mvc

ASP.Net MVC - model with collection not populating on postback

I have an ASP.Net MVC application with a model which is several layers deep containing a collection. I believe that the view to create the objects is all set up correctly, but it just does not populate the collection within the model when I post the form to the server. I have a piece of data which is found in the class hierarchy thus: ...

ASP.NET MVC route for serverside imagemap

...

database in App_Data not persisting data

I have a a sql database in my app_data folder and my connection string looks like this: Server=.\SQLExpress;AttachDbFilename=|DataDirectory|wikipediamaze.mdf; Trusted_Connection=Yes; I'm using Fluent Nhibernate, and everything is mapped properly. I'm able to connect to the database fine and even update and insert rows with no problem. ...

Best Practice for handling cascading dropdowns other postback scenarios in ASP.NET MVC

I have seen a few examples of handling cascading dropdowns in ASP.NET MVC using jQuery and Ajax. Of course, this requires javascript to be enabled. Assuming javascript is disabled what would be a best practice for handling cascading dropdowns. Here is a real-world scenario of a asp.net web form I develop for a inventory app for th compa...

How do I highlight the Html.ValidationMessage's on a AJAX Post?

I have a form which I post back via jQuery AJAX. In my controller it checks for errors in the ModelState and returns these errors in a ContentResult and the user sees the errors in an updated DIV. How can I get the little * next to the fields when there are errors? Thanks ...

MVC Crystal report viewer

hi, when iam trying to bind the data to the crystal report viewer through the view by using MVC architecture,iam getting an error like"Error programming" message on the crystal report viewer.can you please give me the answer please. thanks in advance ...

Validating form using ModelState

Hello, I am trying to validate a form using ModelState generally the same way as in tutorials on asp.net/mvc. However I dont have my own database or their objects and want to validate against Formcollection. I am not sure, how ModelState works, so maybe I am shooting in the dark, but here is the code, that crashes: <%=Html.TextBox(Html....

Windows authentication & SQL Membership services

I have an ASP.Net MVC intranet site which uses Windows Authentication to know who is logged in (no anon browsing allowed). The first time the users visit, I collect some very basic information from them for their Contact object (such as name, email, country) which is then stored in the apps database. I want to make the site role based, ...

Session object is null in ASP.NET MVC Controller

This is a strange problem because yesterday I was executing my code in Cassini (VS2008) and in the action method of the controller the Session object was valid and holding session data. Today I restarted VS2008 and opened the project and the Session object is null. What are the reasons that the Session object could be null in the Contro...

What do you refer to non ASP.NET MVC ASP.NET as?

When ASP.NET came out people started referring to ASP 3 (and below) as classic ASP. Does anyone do this when refering to ASP.NET (non MVC) in relation to ASP.NET MVC? It seems awkward when answering questions refering to normal ASP.NET as the "non ASP.NET MVC ASP.NET!" Please don't explain the differences between the two- I know that a...

Returning a list of keys with ModelState errors

I would like to return a list/array of all keys that have an error against them. I have tried to do ModelState.ToList(item => item.Value.Errors.Count>0) but it says I can't have that sort of expression for some reason. Thanks ...

How do I use MSHTML on a machine that does not have Visual Studio installed?

I am using mshtml to parse HTML in my ASP.NET-MVC application. Works great on my development machine, which has VS2008 Professional installed. Works great on my staging machine, which has VS Express 2008/WebDev installed. But it throws a FileNotFoundException when trying to load the COM object on the production server, which has no ve...

What methods are available to stop multiple postbacks of a form in ASP.NET MVC?

A common web problem is where a user clicks the submit button of a form multiple times so the server processes the form more than once. This can also happen when a user hits the back button having submitted a form and so it gets processed again. What is the best way of stopping this from happening in ASP.NET MVC? Possibilities as I se...

javascript injection asp mvc

i have created the controller : [Authorize] [AcceptVerbs(HttpVerbs.Delete)] public ActionResult Delete(int id) { try { db.DeleteObject(db.AEROLINEA.FirstOrDefault(x => x.AEROLINEAID == id)); db.SaveChanges(); } catch { /* TODO:Display message*/ } return Vie...

asp .net mvc OnResultExecuting modify filterContext Result

Simple question. How do I go about overriding the OnResultExecuting method in my Controller and force a different ActionResult instead? Sample code is below. Currently the original ActionResutl continues to execute and my new RedirectResult is ignored. RedirectResult redirectResult = new RedirectResult("http://www.google.com"); filterC...

correct way to do this with asp.net-mvc? list of comment on an item

you have some info on an item and you got a list of comment on that item how would you manage add/delete/edit with the route? for now I have this: /item/details/7/editcomment/1 /item/details/7/delcomment/1 /item/details/7/addcomment is that the correct way? ...

Can XSLT render MVC ASP.NET Controls/Code?

Is there any way to render ASP.net MVC controls or code directly within a XSLT/XSL transform file under the .NET Framework? If so can you provide me with a sample or link? ...

How to edit and continue in Visual Web Developer 2008 Express Edition and ASP.NET MVC?

I've enabled Enable Edit and Continue on the Web Properties page and it's also enabled in my configuration, yet Visual Web Developer 2008 Express Edition refuses to allow me to edit source files of an ASP.NET MVC project. I can edit the aspx file with no problem though. Any ideas what's wrong or what's missing? ...

how to pass information to a view from a controller then getting it back in the controller with asp.net mvc?

I'm pretty sure it's easy but I can't seem to find it. I have 2 table linked together in sql; table1 with field named idTable1, info table2 with field named idTable1, idTable2, moreInfo when I show the view that can add a new row into table2, I have access to idTable1 <%=Html.Encode(Model.idTable1)%> but when I submit for ...

ASP.NET MVC: Authorization inside an Action - Suggested Patterns or this is a smell?

Hello, I have an ASP.NET MVC application using Authorization Attributes on Controllers and Actions. This has been working well but a new wrinkle has shown up. Object: Shipment Roles: Shipping, Accounting, General User The Shipment moves through a workflow. In state A it can be edited by Shipping only. In state B it can be edited b...