asp.net-mvc-2

Sending url params and POST body to a MVC 2 Controller

Hi, I'm having some issues trying to make a HTTP PUT (or POST) using WebClient against a MVC 2 controller. The exception is: The parameters dictionary contains a null entry for parameter 'total' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Company(System.Guid, Int32, Int32, System.String)' The controller...

Passing HttpFileCollectionBase to the Business Layer - Bad?

hopefully there's an easy solution to this one. I have my MVC2 project which allows uploads of files on certain forms. I'm trying to keep my controllers lean, and handle the processing within the business layer of this sort of thing. That said, HttpFileCollectionBase is obviously in the System.Web assembly. Ideally I want to call to ...

how to rotate around each record in linq and show that in view

Hi, I have four tables in my database and i want to join that's and return record's and show that into searchController! My query is this: public IQueryable PerformSearch(string query) { if (!string.IsNullOrEmpty(query)) { var results = from tbl1 in context.Table1 join tbl2 in context.Table2 on tbl...

LINQ to SQL - Grouping categories by parentId

I am trying to construct a navigation menu using a Categories table from my db. I have a similar layout as below in Categories table. public List<Category> CategoryData = new List(new Category[] { new Category{ CategoryId = 1, Name = "Fruit", ParentCategoryId = null}, ...

ASP.NET MVC2 FormsService SignOut is not actually signing out

Hi, I am working with asp.net mvc with the forms authentication cookieless UseUri and i did as below. Create a new asp.net mvc 2 application Edit web.config and add cookieless="UseUri" to the Forms tag (line 25 on a new project) Open HomeController.cs and add [Authorize] before the About method. Hit F5 to run the project. Click the R...

initialize jquery slider with hidden input value from database.

I'm using a slider as user input for a screen. Basically it's a bulk update screen where there is a table with multiple rows, thus multiple sliders. I created it so that the hidden value is what gets posted in the form. <td> <input class="percentageProvidedHidden" type="hidden" name='<%= "Values[" + i + "].Percentage" %>' value='<%=...

ASP.NET MVC 2.0: How to read querystring value

I am trying to build a small ASP.NET MVC 2 application.I have a controller class with the below method in it public ActionResult Index() { TestMvc.Models.PersonalInformation objPerson = new TestMvc.Models.PersonalInformation(); objPerson.FirstName = "Shyju"; objPerson.LastName = "K"; objPerson.Email...

Webforms Vs Asp.Net MVC VS2010 LoadTest

A colleague of mine ran a simple load test using VS2010 on a Webforms project and an Asp.net MVC project and noticed that Webforms was serving around 83 requests per second whereas Asp.net MVC was serving 28 requests per second. Both the sites were published on the same server with similar settings. Webforms project had 10 pages 5 of th...

ASP.Net MVC 2 - ModelBinding and Dictionary<int, int>

Hi, In my interface I have a list of text boxes, something like this : http://screencast.com/t/YjIxNjUyNmU The number of textboxes is unknown as each of them is associated with a Template. In my page, the goal is to associate a number to some of those templates. Here is a sample HTML code : <% // loop on the templates foreach(IT...

Sending xml to an ASP.NET MVC Action Method Argument

Is it possible to send POX (plain old xml) into an action and have that action perform model binding to an object for you. Have seen this done with JSON but dont see anyone doing this with xml. ...

MVCContrib grid - select row

I have a MVCContrib grid that shows selected properties from an Account object. I want the user to select a row and be taken to another page to view the full properties of the object represented by the row they clicked. How do I add a .Selected action to the rows of the grid? ...

MVCContrib grid - sorting and paging

Every example I've run across demonstrating paging and sorting assume that the controller action that populates the grid does a getAll on the datasource. However in my application I am calling a web service that performs a search based on some form criteria passed in. When the pager or sort calls the action it sends nulls for all of th...

Can't disable jQuery cache

Update I figured out that it must be caching problem but I can't turn cache off. Here is my changed script: <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> jQuery.ajaxSetup({ // Disable caching of AJAX responses cache: false }); ...

Adding global blank option to DroDownList in MVC

Is there a way of using a templated helper in mvc so that each and every select list in my project has a custom default 'Choose an option' with null value etc. The posts I have seen seem a little complex, is it possible to have a DropDownList.ascx file in shared view folder with something like this: <%@ Control Language="C#" Inherits=...

Customize ValidationSummary in ASP.NET MVC 2

I want to customize the html output of ValidationSummary in ASP.NET MVC 2 from <div class="validation-summary-errors"> <span>Oops! validation was failed because:</span> <ul> <li>The Title field is required.</li> <li>The Body field is required.</li> </ul> </div> to <div class="validation-error"> <p>Oo...

ASP.Net MVC 2 - better ModelBinding for Dictionary<int, int>

Hi, In some special cases you will need a list of textboxes (to deal with n - n associations) whose id is not know before runtime. Something like this : http://screencast.com/t/YjIxNjUyNmU In that particular sample I'm looking to associate a count to some of my 'templates'. in ASP.Net MVC 1 I coded a Dictionary ModelBinder to have a c...

Html.DropDownListFor() in Mozilla Firefox

I'm rendering a drop down list using Html.DropDownListFor() extension. The markup I get is as follows: <select id="NationalityId" name="NationalityId"> <option value=""></option> <option selected="selected" value="1">Estonian</option> <option value="2">Russian</option> <option value="3">Ukranian</option> <option value...

Editable Tree View for MVC using jQuery

Hi All. I'm looking for an Editable tree view which easily lets me to make new items, rename and delete them. before i started using MVC i used the Obout tree which works quite well: http://www.obout.com/t_db/index.aspx but this isnt going to run in jQuery, so i'd like to know if someone has some experience in a jQuery solution. i g...

Is using jquery to call a WCF Data Service from the UI violating the MVC pattern.

I'm fairly new to ASP.Net MVC 2 and understand the MVC pattern in itself. But my question is what's the best way to populate dropdownlists in the UI sticking to the MVC pattern. Should I be going through the controller? Every article I've seen to do this shows how to do it using javascript and jquery. I have a test application that I'...

Changing User in MVC 2 MockHttpContext breaks Test?

I changed the following line: private readonly IPrincipal _user = new GenericPrincipal(new GenericIdentity("someUser"), null /* roles */); to private readonly IPrincipal _user = new GenericPrincipal(new GenericIdentity("realUser"), null /* roles */); and the following test broke, but I am not sure why and I am not ...