asp.net-mvc

How to display error message on jQuery modal in MVC

Hello, I am trying to lookup an employee by their ID using a jQuery modal. My Modal has an input text box for the employee ID and a Search button. Once the search button is clicked I have the value looked up in a db and if no result exists I am looking for an error message to display on that same modal. My controller looks like this...

ASP.NET MVC: Event when a view is requested.

Are any events raised when a controller requests a view or partial view? Similar to FindView/FindPartialView on the IViewEngine interface. I need to know what views are requested, but dont want to have to write my own view engine. Any suggestions? ...

Why Does Thread.CurrentThread.CurrentCulture Change between Page Rendering and HttpModule.PostRequestHandlerExecute?

I'm creating an HttpModule that needs to know the value of Thread.CurrentThread.CurrentCulture as set in an MVC application. That value is currently being set by the BaseController, but when my HttpModule.PostRequestHandlerExecute() method fires, it reverts to what the Culture was prior to page rendering. I have duplicated this by creat...

Multiple joins into one list

With the query below I am doing multiple joins and selecting them all. I want to return this result into a list, so in this case I would have a List with a count of three, assuming that there are three addresses associated with this single customer id order...Right now the query works but I put exp.ToList() it gives me essentially a 2d l...

BestPractices: Is it acceptable to use more than one repository in a MVC-Controller?

I have a many-to-many assocition between an Employee and a Team. Foreach entity I have a repository. Now I use ASP.NET MVC and I created a EmployeeController. I also created a View to edit an Employee. For this view I need a DropDownList with all Teams. The problem is that my EmployeeController only has got EmployeeRepository. So how ca...

Mvc RenderPartial to spark view

Sorry if there is another question that covers this. Here is my problem. I am using Html.RenderPartial, i am also using T4MVC. <%Html.RenderPartial(MVC.Shared.Views.MainMenu, Model.Menu); %> spark view: <ul class="menu"> <for each="var menuItem in Menu.ChildItems"> <if condition="menuItem.ChildItems != null"> ...

ASp.net MVC 2 changed how tryupdatemodel works, what is the easiest way to fix my code?

I initialize my strings to blank, not null. Which worked fine in MVC 1, using tryupdatemodel in that any text entries that had no text in them would be set to a blank string, in MVC 2 RC2 apparently (at least from my testing) it sets them to null / nothing. So now I'm getting errors from my validation layer which requires those to be bla...

returning json data from controller

Hi, My Colmodel in javascript looks like this jQuery("#testGrid").jqGrid( //Some code colModel: [ { name: 'field1',index: 'field1', width: 113, align: 'Center', formatter: selectCheckboxFormatter, sortable: false }, { name: 'field2', index: 'field2', width: 113, align: 'Center' }, { name: 'field3', index: 'field3', width: 120, align...

How do I resolve ambiguity between my project DLL and a DLL in the GAC?

I am currently working on another issue in my ASP.NET MVC project. In an effort to better understand what is happening in the codebase I decided to reference the ASP.NET MVC Source Code project in my own project by adding the solution file to my references. When I did this, I started getting HTTP 404 errors. It just so happens I had...

Actionresult doesnt get called by routelink. Formcollection the culprit?

Hi guys. I am fairly new to MVC. I am trying to set up a search page that searches a database and returns results. The search box is within a Html.BeginForm in my View, and looks like this: <% using (Html.BeginForm()) { %> <%= Html.TextBox("searchBox", null, new { @id = "searchBox" })%> <div id="searchButtonsDiv"> ...

Return empty string using Linq to SQL - Related table with no rows - ASP.Net MVC

I have 1 to many relationship with the following tables - Person and Email. When using linq to sql and ASP.Net MVC, I'd like to show the first email or an empty string in my Person view using code like this: <%= Html.Encode(Model.Emails.FirstOrDefault().EmailAddress) %> In cases where there are no email rows, I receive a NullReference...

Is there any good substitute for BuildURLFromExpression

Hi All , I am using MVC ASP 1.0 , how can i acheive the functionality done by BuildURLFromExpression method ? basically i am trying to get image from Controller thanks ...

Why it's not a good idea to pass entities as Models in MVC?

We're developing a pretty large application with MVC 2 RC2 and we've received some feedback on the way we're using the Entity Framework's Lazy Loading. We're just getting the entities in the controller and sending them as models to the Views, that is causing that the view code asks the Database for the navigation properties we are usin...

Tokenizing autocomplete jquery plugin not working with ASP.NET MVC

Hi I am using the autocomplete plugin but for some reason it is not getting to the controller when I start typing in the text box. Has anyone used this? or worked with this? or got a working example? I've tried changing the url to /Referral/Get but still does not work $("#uxSearch").tokenInput("../Referral/Get", { ...

ASP.NET MVC - Strongly typed view model, where does it belong?

I'm trying to create a strongly typed view model as John Sheehan suggests here. Where should it go? I can make arguments to myself for Model, View, and Controller. ...

A good rules engine for asp.net-mvc applications

I looking for a good Rules Engine to work with in my asp.net-mvc applications. What good options do I have? ...

How to preserve simple HTML formatting to textbox input ?

I only want to maintain the paragraph structure of the users input into a textbox. When I retrieve the text from db, all structure is lost. What's easiest way to save text as recorded? ...

How to update custom ModelBinder to work with altered ModelBindingContext.ValueProvider interface in ASP.NET MVC RC2

I have a custom model binder that takes a comma separated list and cleans out any empty values, then passes it along to the default model binder. This worked in ASP.NET MVC Preview 2, but when I upgraded to RC2, the below won't compile because the interface of ValueProvider only has a GetValue() method, no [] accessor. Is what I'm doing ...

AutoPostback from Html.Listbox in ASP.NET MVC?

Now, i may very well just be being incredibly thick, but I'm struggling to find how to do autopostback with a Html.Listbox in ASP.NET MVC 1. What I'm trying to achieve is just a simple if value of ListBox1 is x then the values in ListBox2 are y, if I change the value in ListBox1 to z then I want the values of ListBox2 to change based of...

asp.net mvc - caching...

I'm looking into caching with ASP.NET MVC and I am also in middle of finalizing web-host. I've two questions... 1) Does caching pose issue when done on shared hosting environment since resources are shared and all? This question may sound silly, but I just do not know how caching works behind the scene. 2) Before I implement cachin...