asp.net-mvc

Automapper string to enum

Hi All, I've found a couple of posts that describe similar scenarios to mine but nothing that has the same concept or has been resolved so I'm sure I will get complaints about this question but I still want to ask it so some of you more knowledgeable than my self can give me some advice. My problem is hydrating a Viewmodel from a Lin...

asp.net MVC : when is IIS giving a 404 and when does it forward it to my app?

Hi, i was wondering about the following: i can define in IIS what to do with page not founds / 404, and also in my app i can put it in my CustomErrors section or just handle it in code. Now as i assume IIS always gets the request first, when does it handle the 404 for itself, and when does it let it pass through to my app? And a side...

Strongly typed Dataset model binding in ASP.NET MVC

In my latest project I have to use strongly typed DataSets. I have a problem submit a form to a POST controller: I get an parameterless constructor error i.e. it does not found the OrderCreate post method on controller. I will appriciate any help. Thank you. Here is my simplified code: View: <%@ Control Language="C#" Inherits="System....

ASP.net MVC - Strongly typed object to represent a Json Object that I pass to the view

I'm using jqGrid to display some data on a page. Within the controller action, we're using an anonymous object to represent the data that the jqGrid needs. My question is, is there a way we can create a strongly typed object to represent the jqGrid data that we are sending with Json()? Main reason for this is so that we can do unit te...

Does C# have any built in objects for turning JSON text into manageable objects or do I need a third party library?

I have all this JSON text that I want to deserialize (or something) into an object with variables so I can run through it and add/change some things and then serialize it back to text. Is there something built in from Microsoft for this? ...

Problem with multiple ASP.net MVC2 applications on IIS7 ( hosting an MVC app. in another MVC app. )

Hi, what i am trying is the following: I got an MVC app. running DIRECTLY in "Default Web Site"... I got another app. ( ProductionService ) which is anotehr standalone app.. Looks like this in IIS-Manager: My problem is, that a requets to "ProductionService" is not routed to the app., but instead is handled by the MVC-app. runnin...

Create Password and Passwordsalt

I have an existing table that has 100 users and passwords. The data type is a varchar. I just created an asp.net mvc application and I want to convert the password to aspnet_membership table. How do I convert varchar password on SQL level as "Password" and "Passwordsalt" in aspnet_membership table? ...

Nullable DateTime Parameter is never bound when calling the action

I have the following function signuture: public JsonResult PopulateGrid(int page, Guid? accountId, Guid? systemUserId, Guid? branchId, DateTime? fromDate, DateTime? toDate, HomeVisitType? homeVisitType) Every single parameter is bound just fine except toDate which turns out to be always null. When inspecting the Request.QueryString["t...

Is ASP.NET MVC vulnerable to the oracle padding attack?

Is ASP.NET MVC 2 vulnerable to the oracle padding attack? If so, what workaround should be implemented? The instructions on Scott Gu's blog appear to only be for Webforms. I tried this: <customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="/Home/ErrorPage" /> however, http://www.example.com/PageThatDoesNotExist ...

MVC JSON actions returning bool

I had my ASP.NET MVC actions written like this: // // GET: /TaxStatements/CalculateTax/{prettyId} public ActionResult CalculateTax(int prettyId) { if (prettyId == 0) return Json(true, JsonRequestBehavior.AllowGet); TaxStatement selected = _repository.Load(prettyId); return Json(select...

How to change this code in to $.ajax so that I can display message after saving to the database?

Hello Friends, I am using this ccode right now.. <%using (Html.BeginForm("SaveNewServiceTypeCategory","ServiceTypeCategory")){ %> <table> <tr> <td>Service type category:</td> <td style="padding-left:5px;"> <input type="text" id="txtNewServiceTypeCategory" name="txtNewServiceTypeCategory" ...

MvcContrib Select Control does not highlight in red on ModelError

I would like the MvcContrib select control to be highlighted in red, but currently I can only show the error text. I currently populate security questions in the view: <%= this.Select(Html.NameFor(x => x.Question1).ToHtmlString()) .Options(Model.AllSecurityQuestions, x => x.Id, x => x.Question) .Selected(Mode...

submit to same action in MVC

In my View (.aspx) code, what parameters can I provide to Html.BeginForm() in order to get it to submit back to the same controller and action that produced the view? ...

How to get all Types using LINQ in Asp.net mvc

Hello Friends, I have this code viewModel.Messages = repository.GetAllMessages().OrderBy(x => x.MessageText); with this I am getting 75 messges and i am displaying all the Messages in the Grid with two columns MessageText and MessageType But I need to write a Linq Query to get all my Distinct MessageTypes from Messages? Can any ...

ASP.NET MVC 2 Data Annotation Validation -- StringLength Minimum not working on client-side

Hi. On one of my models I have a property annotated with: [StringLength(60, ErrorMessage="Title must be between 60 and 10 characters", MinimumLength=10)] When the form posts to the server, if it's under 10 characters, then validation fails as it should do. However, on the client-side, it only checks that it's under 60 characters -- n...

How can I build a recursive function that builds an MvcHtmlString Breadcrumb trail when I don't know the object beforehand?

I believe that I'm going to need to use an html helper method that uses lambda expressions to accomplish this. I was thinking of doing something along these lines: public static MvcHtmlString GetCategoryBreadCrumbs<T>( this HtmlHelper html, IEnumerable<T> currentCat, Func<T, T> parentProperty, Func<T...

Is anything wrong with my javascript format?

I'm on a .NET MVC2 project and have a reference to SomeClass.Home.js and jquery in the masterpage. My SomeClass.Home.js looks like this: SomeClass.Home = {}; $(document).ready(function () { SomeClass.Home.SomeMethod(); }); SomeClass.Home.SomeMethod= function () { alert("hello"); }; The call to SomeClass.Home.SomeMethod ...

WebRequest and WebService call asynchronously in C#

I have MVC application (applies to non MVC as well) where a user is posting in data. I need to take this data, send it off to two seperate end points (one using a WebRequest form POST and one using a Web Service), parse the result, and send the result back to the original user. The issue at hand is that both end points take about 20-30...

ASP.NET MVC Redirect outside area

A simple task in MVC,sometimes becomes a hard challenge. Well,i have an Area called Admin.I've a page named "Forbidden" inside the Shared's directory in this area. The goal is simple:I need to create an Html.ActionLink that generates a link to return to Home page which is OUTSIDE the Admin area. So i try,<%= Html.ActionLink("Back","In...

How can I get Html.RenderAction to call the Get method on a Post?

After rendering a view on a Post, a call to RenderAction inside the view will call for the Post method. Is there any way to specify I want to call the Get method instead of the Post? ...