asp.net-mvc

Error wrong type?

The model item passed into the dictionary is of type '...', but this dictionary requires a model item of type '...' Does anyone know how to solve this error? My controller class: public class MapsController : Controller { public ActionResult Index() { return View(Project.Find(68)); } //[AutoRefresh(Duratio...

How to get user email address from ASP.NET MVC Default Mempership Model ?

hi , i can get the user name as : User.Identity.Name , but how to get user email address because it most be stored (there is a textbox for it in the registration form) ...

ASP.NET search indexing building strategy

This is what I'm planning to do and I'd appreciate anyone's input: I've built a forum in Asp.net MVC and now want to add Lucene.Net for search. My plan is to run an index builder thread every 5-10 minutes to update the search index with the changes made to the each discussion. The way it will work is I keep the date and time for the l...

Is it possible to redirect to an action, and post?

I want to redirect to an action, and post to the action instead of get (and post the key: ID, with value 100). is this possible? ...

does mvc.net validation support the concept of ValidationGroup

Coming from the asp.net background, I really appreciated the concept of 'validationGroup' when adding validation to a page. I've been searching for a corresponding concept within mvc.net and haven't had much luck. Is this concept available in mvc.net? If not, what alternatives do I have? ...

Why is ie7-js requesting CSS files from my application?

I'm trying to use the ie7-js library to make my browsers less than ie9 think they're ie9. The library is hosted here: http://code.google.com/p/ie7-js/ and I'm referencing it as follows in my master page: <!--[if lt IE 9]> <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"&gt;&lt;/script&gt; <![endif]--> Since I...

Preserve data in MVC

I am implementing a complex search module with result page support paging. Most of examples provided just passes pagenumber as a parameter for the Index action, and the action uses the pagenumber to perform a query each time the user hit a different page number. My problem is that my search take many many more criteria(more than 10 cri...

Custom principal in ASP.NET MVC

I want to be able to access custom properties for an authenticated user like UserId and FirstName without querying the database each time. I found this site through a post on Stack Overflow and I like the approach - but I use IoC / repositories and decided not to try and get global.asax to communicate with the database for fear that it ...

ASP.net MVC put complex data (array) to controller method

I'm porting an ASP.net Web Forms application to MVC. The application uses AJAX, by means of Ajax-enabled WCF Web service and asp:ScriptManager. I send an array of objects for service, it handles it just great. Code example, <script type="text/javascript"> $().ready(function () { var ser = new Services.TasksService(); ...

Best way to redirect to a hashed version of a URI?

So all of the pages on my web application have URIs of the form http://www.example.com/#some-hash and the like. But of course, if the user visits http://www.example.com/some-hash they should get redirected and experience the site in its usual glory. OK, no problem, right? Just write some kind of global HTTP request interceptor that auto...

Help needed on ASP.NET MVC data processing

I'm developing a web project with service and repository layers in ASP.NET MVC 2. I'm using Entity Framework. I have two generated EF classes. Namely, Company and User. Company has two fields CompanyID {int} and CompanyName {string}. User has three fields UserID{int}, UserName{string}, BirthMonth{smallint,can be null} and CompanyID{int,...

MVC, Entity Framework, Business Logic

Although I believe I have a good grasp on MVC (from Rails), I'm learning the "MS Way" with ASP.NET MVC. Also, I am learning Entity Framework as well. I've created an Entity called User in my Models folder. Using LINQ to EF I can retrieve records and all is good. Now, I want to put some business (or what I call, domain) logic in. But...

IIS 5.1, MVC 2, SQL Server 2005 deployement error

Hello, I have deployed a solution correctly on IIS 5.1 (hopefully) as it loads up and shows a "User not authorised page which I created myself". The fact this shows is a good sign but it also hides any errors as I think I should be authorised. To try an get an error message I ran a method on a controller which didnt require any author...

ASP.NET MVC2 Post to SSL and WCF Service

I have an ASP.NET MVC2 application hosted in a non-secure environment (http), also I have my account services (WCF) on an SSL server. I need to post a form that is on the non-secure http application to a secure SSL and access then the service. By no means I'm allowed to host the application in the SSL server (because it will loose the lo...

jQuery UI Autocomplete with ASP MVC

I'm trying to get the jQuery Automcomplete thing to work, but it wont do as i want :P This is my code: JavaScript: $("#CustomerID").autocomplete({ source: function(request, response) { $.ajax({ type: "POST", url: "/customer/search", dataType...

Aliasing Querystring Params in BeginForm with FormMethod.Get - MVC2

The Question Is there a way to alias the parameters generated by MVC, in my case it would be the searchTerm param? For example, in my viewmodel it would still be SearchViewModel.searchTerm but the URL would look more like /Home/Search?s=jimmy Search Form <% using (Html.BeginForm("Search", "Home", FormMethod.Get)) {%> <%: Html....

Add An Anchor To RedirectToAction's Result?

I'm trying to create an extension method similar to MVCContrib's RedirectToAction method by creating a method that will take an #anchor argument and add it to the Url. I am familiar with this question but it's not strongly typed. It's also possible to add values to the query-string, but that won't work for an anchor. public static Redir...

The specified LINQ expression contains references to queries that are associated with different contexts.

am getting this error on this code (this is an MVC project into which I am trying to integrate Entity Framework): List<string> consultantSchoolList = new List<string>(); // districts managed by consultant IQueryable<string> consultClients = rc.consultantDistrictsRepository.districtsForConsultant(userID); ...

Escaping a double-quote in inline c# script within javascript

I need to escape a double quote in inline c# within javascript. Code is below: if ("<%= TempData["Message"]%>" == "") { // code }; Normally, I would just use single quotes like so: if ('<%= TempData["Message"]%>' == "") { // code }; However, TempData["Message"] has single quotes within it (when it contains a link generated ...

What are some good interview questions for mid-level developers involving ASP.NET MVC?

I have to do some interviewing for mid-level Software Engineer positions and our team uses ASP.NET MVC. Some candidates have experience with the technology and others do not. For the ones that do, we'd like to gauge their expertise. We have come up with some of our own questions, but thought the community might have some good perspective...