asp.net-mvc

Asp.net MVC membership - wrong username casing used

When a user logs in with the default implementation of the membership service in an asp.net mvc project, they are logged in with a username with whatever case they used when logging in. For example, if I create a user called John. If I then log in as joHN, then User.Identity.Name will equal joHN. I would like it to equal John, the act...

jQuery posts data to wrong relative URL.

I have an ASP.Net MVC application. I am trying to post data to an action, and then just render the output. I have a page where you can view a product, so www.mysite.com/product/details/1 shows the product. On this page, I render a partial view through RenderAction() that contains some pricing logic. I want the user to select some options...

Could not load file or assembly 'Interop.QBFC8Lib' or one of its dependencies

I am using a quickbooks sdk that containst the QBFC8Lib dll everything works fine on my dev machine. when I publish to my live server I get the following error: System.BadImageFormatException: Could not load file or assembly 'Interop.QBFC8Lib' or one of its enter code heredependencies. An attempt was made to load a program with a...

How can you get T4 to skip transforming for custom methods?

Is there any attribute or other method of getting T4 to skip trying to transform custom methods? Where it shows a warning saying T4MVC.tt doesn't support MyController.Method because it doesn't return a supported ActionResult type? For example: On a BaseController having this method: public UrlHelper GetUrlHelper() { return new Ur...

Ninject to bind on different controllers

I am trying to Bind two concrete classes to one interface. What command should I use in Ninject to do that? What I am trying to do is to Bind two concrete classes to one interface base on the controller Name. Is that possible? I suppose that in ninject you use the .When to give the conditional but there is no tutorial out there where the...

Need To Access ViewData on MasterPage... or other options

I am using MVC2 in VS2010 with .Net 4.0. I have a situation in which I will have a bunch of partial views that I need to all have the same template. Basically I need them all wrapped with the same DIV (and other junk). I just want one place to change this DIV... so I used a master page. It works great, all the partial views use that ...

Disabled textbox gets posted in one view but not in another

I have a strange problem where I have an Edit view that renders disabled textbox for slug, so user can see the slug of the content he is editing but cannot change it. The slug can only be changed on the Create view where the textbox is enabled. In Edit view only Title can be changed. In edit view the Slug textbox gets populated from the...

How to call a server side method on losing focus from a textbox, asp.net mvc

I have two textboxes, one isfor 'program' and the other for 'description'. I have a predefined set of programs and it is associated descriptions in the database. Example : For program named 'Test' it has the description as 'Valid' in the DB Table For example, when enter a program name in the program textbox as 'Test', its associated ...

ASP.NET MVC Trouble getting data and related data to the view. (View Model Pattern?)

My site has Users. My site has Items. Users can leave a Review of an Item. Users can leave a Rating of an Item. When users rate an Item, they rate it in different categories: a rating for build quality, a rating for usefulness, a rating for aesthetic appeal. So, in my database, my Reviews table would have one entry and my Ratings tab...

Filling GridView on some Button Click in MVC

Hi, I am working on some project which is in classic ASP.NET, but I need to migarate that into MVC Right Now I am having a page with one button and gridview which get fill on clicking the button. Gridview has the functionality like EDIT, DELETE, Paging, OnRowCommand Event. How should I perform this page through MVC. I know gridview c...

How to use Linq objects to validate a view in MVC 2

Hi I would like to use Linq and strongly typed views in the right way. at the moment I do the following: Make a Model to verify agianst: public class Menu { public int Id { get; private set; } public string Text { get; private set; } public string Action { get; private set; } public string Controlle...

Javascript parameter between <%%>

Hi I have a problem.I have a 'demo' controller with 'demo' action what get a parameter, and i want to give them in javascript. aspx: <script type="text/javascript"> function openDefault(miez) { var manager1 = $find("<%= RadWindowManager2.ClientID %>"); var str = "/demo/demo/" + miez; manager1.open(str3, "RadWindow...

Populating dropdowns/selection lists

Hello! I'm still in the process of learning DDD. I'm writing an ASP.NET MVC Application and I have several drop downs that I need to populate from the database. I've created mapped entities for every type (status, result, etc.) What I can't figure out is from where I should be getting the data. Creating a separate repository for each ...

How to get a common element (like Version number) into Site.Master?

Hi guys, Suppose I have a Site.Master page. I want to display something like the version number of the application (lets assume it is available in the the BaseController as a string) in the Site.Master. What would be the best way to do that? I know one way would be to have a Base view model class which would contain the version elemen...

Is it i possible to prevent certain PartialViews from being served if requested directly?

I'm working on a site that has routes to actions which render Partial Views. A lot of these partial views are components which together make up a complete page. For instance on a search page I'm working on has a text box, a list of tabs, and a Table. Seach of these can be accessed with a URL similar to /Search/SearchPanel /Search/Tab...

Nerd Dinner pagginated list - how do I add a linq orderby clause dynamicaly? ANYONE????

Hi, I have implemented nerd dinner method of paging- which works great. But I want to be able to dynamically be able to order by certian fields. How would I go about implementing this. Here is my code? Controller: PaginatedList<Classifieds_Ads> pageOfClassifieds = new PaginatedList<Classifieds_Ads>(classifiedsRepositry.GetClassified...

LINQ to Entities does not recognize the method 'Int32

public ActionResult ReadXMLDevices(int groupID) { var query = from k in XMLEntities.unassigneditems where k.DevOrAcc == true && k.Group == groupID select k; var view_query = from i in query select new GetFreeDevices { MArticleNumber = i.Artic...

How do I validate a property from a different class with DataAnnotations

I have a competition class and a competitionEntry class. A competition can have 5 questions (just string values) and the competitionEntry can have 5 answers (also only string values). How would I validate that if a question is present that the answer should be present as well? I think I need a custom validation attribute but how would...

Nested master pages in ASP.NET MVC 2

I know how to make nested master pages in webforms but is it also possible in MVC2? I know how to do it with markup only though. I would like to set it from code depending on a criteria. Is it possible with some code in the controller to define the nested master page and master page? ...

Pattern for updating database through a property when using an internal mapping

I've reached a bit of a problem in my app and I'm not sure how best to resolve it. I'm using Linq to Sql and I have a domain object which wraps the Linq object so I don't directly expose Linq objects to my front end. So I have something like: class MyOrder : IOrder { Order _order; // this is the Linq entity public MyOrder(Or...