asp.net-mvc

Passing Textbox Value using Html.ActionLink

I have a table that lists products as well as displays a quantity text box and an Html.ActionLink. Each quantity textbox has a unique id derived from the product id. I think this should be simple but I can't seem to figure out how to get the value in the associated textbox passed to my controller when the user clicks on the link. My c...

How do you get unit tests to use routes in ASP.NET MVC?

I am writing unit tests against my ASP.NET MVC application, in particular I am testing an HtmlHelper extension method that I wrote. There is a line inside of the extension method: var innerHtml = htmlHelper.ActionLink(text, action, controller, routeValues, null); When I run this inside of my unit test, the href of the generated URL i...

Hierarchical Grid with MVCContrib

I am trying to come up with the best solution for creating a hierarchical grid in my ASP.NET MVC project. First, I looked at jqGrid, and found it's "treeGrid" option which is exactly what I'm looking for. However, from what I can tell, jqGrid is not free, and my client is not interested in purchasing a license for it. To get an idea o...

Does ASP.NET MVC perform better under IIS7 versus IIS6?

I'm running my ASP.NET MVC app on an IIS6 host right now, and they're not willing to upgrade my server, nor move my site to an IIS7 server - unless I purchase a new account to transfer to. Under IIS6 I understand there are a lot of wildcard mappings happening to get the .net framework to process the incoming connections for each type. ...

passing parameters to .aspx page using renderpartial

in my index.aspx page i want to render another module.aspx page using renderpartial which then render a .htm file depanding on which parameter is passed from index.aspx (it would be number ie 1,2 etc ,so as to call different different .htm file everytime depending on the parameter) 1). now i want Index.aspx page to render module.aspx...

Showing/Hiding Links in an ASP.Net MVC View

I'm trying to figure out how to show/hide links for users based on their roles. I know how to set the authorize attribute for an action method, but I'm having trouble making links show hide in a view if the user is say, an admin or a manager in my roles database. Any good articles or code example someone can point me towards? ...

How do I add an order by to server side code in my mvc View

I would like to append to the first line '.OrderBy' and specify a field called 'OrderById'. I'm finding it confusing, i.e. Func & KeySelector etc, i've looked up some examples but not really getting anywhere, cannot find an example that suits what i'm trying to do. <% foreach (var item in Model.PaymentItemTotals) { %> ...

Using MS MVC and DDD, How and where to define a MVC ActionMethod parameter class that involves an entity, a value object, and a few extra fields?

I am just at the brink of going "Ah HA!" when it comes to coding Domain Driven Design. The question is How and where to define a MVC ActionMethod parameter class that involves an entity, a value object, and a few extra fields? The entity and value object classes are defined in my repository. Do I: Create a custom class in the reposi...

Fluent NHibernate: How to tell it not to map a base class

I have been googling and stackoverflowing for the last two hours and couldn't find an answer for my question: I'm using ASP.NET MVC and NHibernate and all I'm trying to do is to manually map my entities without mapping its base class. I'm using the following convention: public class Car : EntityBase { public virtual User User { get...

Problem opening MVC project in Visual Studio 2008

I was given an MVC project, but I can't open it. Visual Studio says 'project type is not supported'. I have Visual Studio 2008 (maybe professional) + mvc last version (2 beta). What must I do? ...

LINQ to SQL throws exceptions when stress tested

I have this web app that is running ASP .NET MVC 1.0 with LINQ 2 SQL I'm noticing a very strange problem with LINQ 2 SQL throwing exceptions (mainly Specified cast invalid or Sequence contains more than one element) when under a certain amount of load. The bigger problem is, I'm not talking about Real Heavy/Professional Stress Testing....

RouteLink as linkname

Hello Is there someway to render RouteLink as the name of the link aswell? i.e <%= Html.RouteLink(...., "myRoute", new { id = 75 }) %> gets rendered as <a href="http://foo/Something/75"&gt;http://foo/Something/75&lt;/a&gt; Is there some neat trick för that? /M ...

RouteLink without link?

Hello Is there some way of generating the link from the route-table without making it a link? i.e only www.foo.com/someroute/34 without it being linked /M ...

Render partial view based on condition

I have a few partial views that should render when the user has a certain Role. Now, I want to avoid doing something like <% if(user is in role){..here goes the html.. }%> I would like to be able to do (at the top of the ascx) : <% this.RenderOnlyForRoles(list of roles) %> Now, in the BasePartialView I have a list of roles that ...

How do I pass a date via the URL, for my Action to read in MVC?

How do I pass a date via the URL? Here is what I am trying to do, as as you'll see the date uses forward slashes which are invalid in the URL http://localhost/Controller/Action/id=0d5375aa-6d43-42f1-91f0-ea73d9beb361&amp;date=02/12/2009 ...

MultiSelectList problem, getting right type

Hello I'm having problems with getting items in a multiselect to get selected. I have this: BookingObject bo = _bs.GetBookingObjects(bookingobjectID.Value).FirstOrDefault(); bo.BookingViews.Load(); MultiSelectList BookingViewsBookingObjects = new MultiSelectList(_bvs.GetBookingViews(), "BookingViewID", "BookingViewName", (IEnumerable...

prepopulate MVC Models with IOC - an alternative to caching?

Hello, I'm considering strategies for a simple-minded CMS implementation for an ASP.NET MVC site. The simple-minded part is that I've abstracted the values used in various partial views, all of which are user controls that share identical CSS layouts. So I'm populating the custom values in the identical partial views from the database ...

ASP.NET MVC: render view to generate PDF: use iTextSharp or better solution?

I display receipt in both HTML and printer-friendly version. HTML version does jQuery tabs, etc, while printer-friendly has zero scripts and external dependencies, no master layout, no additional buttons, inline CSS, and can be saved as HTML without problems. Since I use Spark View Engine, I though maybe it's a good idea to generate PDF...

ASP.NET MVC + jqGrid

Hello, I am using jQgrid with ASP.NET MVC. I am having a couple of problems. I would like to draw the grid when the DOM is created, but I would like to load the data after, when I select a TAB in a tab page. I can’t find any example for that. Is there anyone who tried that? I am using an custom navigation bar: (”#AttachmentsGrid”).navG...

Am I wrong in wanting to roll my own Authenticate / Authorize system given the following requirements?

In my pet project I want to have a user system with the following requirements: It needs to work with Db4o as a persistance model I want to use DI (by means of Turbine) to deliver the needed dependencies to my user model It needs to be easy to plug in to asp.net-mvc It needs to be testable without much hassle It needs to support anonym...