asp.net-mvc

Hosting Asp.Net MVC Applications

I am working on an Asp.Net MVC project. I had a doubt and please someone clarify it fast.. --> Do we need the MVC framework installed in the Hosting server from where the application is installed. I have installed the MVC framework on my developer machine but do we need the framework installed in the hosting server also. ...

Html.DropDownList Validation Error With No Validation Set

I currently have no validation for my drop down list, but nevertheless, I get a validation error in my ModelState when no value is selected. Is there any automated validation when you specify a default option? It isn't part of the Model, so it definitely isn't a missed attribute! <%= Html.DropDownList("CategoryId", (IEnumerable<S...

Using NHibernate in Asp.Net MVC

HI All, What are the steps to use NHibernate from the model component of MVC? ...

how to test asp.net mvc post actions using MvcContrib.TestHelper

I am trying to test my routing configuration using the excellent MvcContrib.TestHelper and I've run into a problem. Please assume that my Routing Configuration is set up correctly and initialised in the TestFixture. I have a controller (TransactionsController) action called Create that takes an input parameter of type TransactionReco...

How to dynamically enable or disable the textbox by using jQuery in ASP.NET MVC?

I have a ASP.NET MVC project with a large list of input textboxes which I want the user to control them independently. Here is the link how it looks like now. Here are some things I want to have: Each enable/disable link only controls each row. The number of rows is not fixed and it will be generated dynamically. It can be 10 or 2...

Setting a timeout for Ajax.BeginForm() in MVC

I have a query that takes a while to return results on our staging box and it has been wired to the front-end using an ASP.NET MVC Ajax.BeginForm(). I have searched the help and the internet but can't seem to find a way to extend the timeout for this operation. ...

Base controller class

I have a base controller class and I would like to pass a Message from the Base class to all controllers and for that message to be available to all views. I've created a basic version below... Section Controller using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Websi...

ASP.NET MVC Dynamically generated image URLs

I have an ASP.NET MVC application where I am displaying images. These images could be located on the file system or inside a database. This is fine as I can use Url.Action in my image, call the action on my controller and return the image from the relevant location. However, I want to be able to support images stored in Amazon S3. In t...

HttpContext.User.Idenity is empty

Hello I'm using asp.net and trying to assign roles for a user with forms authentication like this: public ActionResult AdminLogin(string password, string username) { User _user = _us.GetUsers(username, password).FirstOrDefault(); if (_user != null) { string _username = _user.Username; ...

using code blocks in head content and link tags

I'm building an asp.net app using themes, and I've assigned a theme to the app using the web config. I have a bookmark icon that I want to use for my page and it is located in the themes directory, but I am having trouble referencing the themes location from a link tag in my header. First I tried putting a code block inside the link ta...

GDI+ Generic Error ASP.NET MVC

Hello, I am having a GDI+ generic error I've tried what everyone says which is make sure that the folder containing the image file that is being read in like so public ImageResult ProfileAsset(string profile, int width, int height) { PhotoDB imgstr = new PhotoDB(); Image FullsizeImage = Image.FromFile( ...

ASP.NET MVC : Update member's LastSeen.

I want to know rough time when a member was last seen in the system. I remember login for 2 weeks. So actual "ValidateUser" on MembershipProvider can be executed quite infrequently. For now I just call DB.UpdateMembershipLastSeenTime() every time from RequireAuthorizationAttribute, i.e. on every authentication-requiring action. Any...

ASP.NET MVC master page.

In a custom viewengine in the findview method the mastername is always empty, even if the page has a masterpage defined. Any idea why, or how can I get the mastername? In the viewEngine class: MasterLocationFormats = new[] { "~/{0}.master", "~/Shared/{0}.master", "~/Views/{1}/{0}.master", "~/Views/Shared/{0}.master" };...

Saving data from MultiSelectList in Edit and Create Views

I have 3 tables: Companies, Subcontracts, and CompanyToSubcontract The CompanyToSubcontract table is the guid of the Company and guid of the Subcontract. I have a MultiSelectList on the Subcontract Edit and Create views where the user can select multiple companies. I finally got it working where it displays the correct companies as se...

NHibernate Concurrency Issue

Over the weekend I realized that an application I'm working on which uses NHibernate as an ORM to a sqlite database has a concurrency issue. I'm essentially looping through a collection in javascript and executing the following: var item = new Item(); item.id = 1; item.name = 2; $.post("Item/Save", $.toJSON(item), function(data, testSt...

How to export to excel from a table on the ASP.NET MVC View Page?

Hi I have a "export to Excel" button on the ASP.NET MVC Page. When the user clicks on this button, the data from the table need to export to Excel including the Header. Could you please the code sample. Appreciate your responses. Thanks. ...

Dynamically adding dropdowns to a form and validating them in ASP.NET MVC

I have a form with various inputs. I have a bunch of optional parameters that have some number of choices. I'd like to allow the user to select these optional parameters in the following way: First, the user clicks the Add Component button at the bottom of the form and two new dropdowns appear above the button. The first dropdown has...

How is the best method to generate a url with ASP.NET?

Hello, I will apprecaite your help in this topic. I need to build a site with friendly urls using url rewriting in order to improve SEO positioning. I've been searching torought web and finally pointing to this two main options : asp .NET with isapi extension asp .NET mvc however, I got no experience on both items so I need you...

Help with asp.net mvc and Select List Dropdown

I want to build this dropdowns with these specific attributes.. How can I do this? Im using LinqToSql. Each Company has employees <select name="companies" id="companies" class="selectable"> <option value="">-- select --</option> <option value="1" title="company1">Company1</option> <option value="2" title="company2">company2<...

Using Html.ActionLink() with ASP.NET MVC & Spark - Syntax?

All, Doing some experimenting with Spark and MVC within NerdDinner. The normal/aspx view works well, and I haven't touched any of the controller code so I'm pretty sure it's not that. <viewdata model="System.Collections.Generic.IEnumerable[[NerdDinner.Models.Dinner]]"/> <set Title="'Upcoming Dinners'"/> <content:main> <li each="p i...