asp.net-mvc

MVC Error: 'object' does not contain a definition for ''

Hi guys, I'm currently working my way through the MVC Music Store tutorial. I'm stuck on page 53 at the moment and I was wondering if someone could help me out. I'm currently receiving the following two errors: 'object' does not contain a definition for 'Artists' 'object' does not contain a definition for 'Genres' I thi...

Why does RedirectToRoute("Default") not redirect to the root?

Given these routes: routes.MapRoute("Test", "test", new { controller = "Test", action = "Index" }); routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); If I call RedirectToRoute("Default") from the Index action of the TestController it redirects to /t...

Problem binding selected value to DropDownListFor inside Editor Template

Description I have a payment page that includes a form for entering bank account information. I have encapsulated the bank account information into a Model / Editor Template. The page itself has its own View Model, which happens to contain a BankAccount property to be passed in to the Editor. [[View Models]] public class PaymentPageMo...

how to send Json output to view in asp.net mvc

Hi, How can i pass the json output from controller action to its view ? As I tried to send before, My code is : public ActionResult Index() { Guid Id = new Guid("66083eec-7965-4f3b-adcf-218febbbceb3"); List officersTasks = tasks_to_officer_management.GetTasksToOfficers(Id); return Json(officersT...

Where to store Shopping Cart in MVC Application?

I am working on a Railway Portal and would require maintaining a shopping cart of components user has selected, there could be multiple components of different type in the cart. I don't see a value in storing the cart in database, would like to store the final order in DB. Where can I store/hold (temporary) the cart data per user session...

MVC Error: Object reference not set to an instance of an object.

I'm close to giving up on this mvc app for today!! I'm following the Mvc Music Store Tutorial and I'm stuck on page 54. this is the error I'm getting: System.NullReferenceException: Object reference not set to an instance of an object. The error occurs in the third paragraph block (dropdownlist) in the following code: <%@ I...

How to write the messages in the Email with two line spacess for each Message

message.Body = "Message: " + ex.Message +Environment.NewLine + "Data:"+ ex.Data + Environment.NewLine + "Stack Trace:" + ex.StackTrace; I am using Environment.NewLine., its going to next line perfectly but I need to put two line separated with ---------------- in between each message Data StackTrace. ...

ASP MVC Razor view extension methods, how to create 'global' view methods?

I am using Razor view with asp mvc preview 3 I am trying to create some methods which I would like available directly in the views. These are not really Html helper methods so I don't think extending HtmlHelper makes sense? my goal, be able to call methods in the view i.e. @HelloWorld(); vs @Html.HelloWorld() I can get Html.HelloWor...

Can we buy Collaboration functionality for ASP.NET?

We are working on a unique eCommerce site. This site is distinctive because when a purchase is made its not made by one person, but a group or "Collaborative" decisions. Individuals can add items to the shopping cart, but in the end the purchase is decided by the group in a “Collaborative” effort or Team Effort. So each team member is g...

Can ASP.NET MVC return a javascript response like Ruby on Rails can?

Hello. I'm diving into ASP.NET MVC and I'm coming from a Ruby on Rails background. I'm trying to understand how ASP MVC handles AJAX functionality and, after reading some of the tutorials on the ASP website, it appears they implement AJAX functionality very differently. One of the ways that RoR handles AJAX functionality is by returni...

Log4Net for ADOnetAdapter..for my asp.net mvc application

I am using log4net code found at: http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppender.html How do I write the code behind to insert the information in to the table? ...

How can I use Html.TextAreaFor() methods in my custom HtmlHelper?

I'm building an ASP.NET MVC 2 website and right now, I have ugly spaghetti code in my view which I would like to make into a custom HtmlHelper. The current code in the view is : <%switch (Model.fiFieldTypeID) %> <% { case 1: // Text area Response.Write(Html.Encode(H...

Is it wise to mix ASP.Net MVC development and ASP.net web form development in the same group of products?

We have a largely asp.net web form team (With some Oracle developers thrown in). Question 1: Is it a good idea to start using asp.net MVC which will mean redevelopment of a number of standard controls for not much benefit. Question 2: Is it a good idea to hire developers where there most recent skills are with asp.net MVC? What are ...

Can I use a MVC Global Action Filter to disable form fields?

Some users of our application will have read-only access to many of our pages, in our current web forms app this means they see the form, but all of the fields are disabled. We're looking at MVC 3 and searching for the cleanest, most idiomatic way of implementing this functionality. Some ideas so far: Some combination of a global acti...

In ASP.Net MVC, how can you use TryUpdateModel to update from a specific object

I have a controller post action that receives an IList<> as a parameter, and would like to iterate that list and TryUpdateModel for each item in the list. Like [HttpPost] public ActionResult SaveList(IList<Stuff> listOfStuff) { // Get existing list of Stuff objects IList<Stuff> currentStuff = db.GetStuffList(); // iterate ...

Wits End with IDictionary<T,T> and ModelBinders, ASP.NET MVC 2.0

Okay, I'm not trying to do anything super complex, I have searched, and searched, and roamed every blog and forum I can find. I am about to tear my hair out because no one just outright shows it working. I want to use an IDictionary in my Model. Nevermind the reason why, that's irrelevant. I just want to do something very simple, and u...

How ASP.NET MVC knows which property of JavaScript control to use when binding?

I know it's possible to change view representation of any .NET type by changing strongly-typed partial view. The most popular example is when simple ToString() call on DateTime instance is changed to a great-looking JQuery UI calendar. My question is - how does ASP.NET MVC know what property of JavaScript control to use when binding to a...

Issue with mvcContrib fluent route testing in asp.net mvc

I have an issue with testing routes using the MVCContrib Fluent route testing. The test fails yet the application recognises the routes. Let me explain.... I have the following routes in my register (shown in order) routes.MapRoute( "PurchaseUnitsPaged", "PurchaseUnits/Page{page}", new {...

Overriding the default 'No Data' Message in MVCContrib Grid

Is it possible to override the default 'There is no Data available' message in MVCContrib Grid with a custom message? ...

how to reset page text boxes data after page post back?

my question seems simple and stupid but first read this, suppose you have a login form which take username and password and post back to controller if login successful then return Homepage(return View("HomePage")) View (not Redirect) then suppose i am Logged off and return Login (return View("Login")) View (again not Redirect) and now ...