asp.net-mvc

How does Select statement works in a Dynamic Linq Query?

Hello, 1) I've a Product table with 4 columns: ProductID, Name, Category, and Price. Here's the regular linq to query this table. public ActionResult Index() { private ProductDataContext db = new ProductDataContext(); var products = from p in db.Products where p.Category == "Soccer" select new Prod...

Migrating Project from ASP.NET MVC1 to ASP.NET MVC2

Hello All I am currently using ASP.NET MVC1 in my project but now i am planing to move on ASP.NET MVC2. What are the changes i need to do in my project to change MVC version? just need to change System.Web.MVC dll with MVC 2 dll or any other changes i required? ...

session timeout with form authentiation, how to display an modal poup or redirect entire page

I am using asp.net mvc and jquery to make ajax requests and when the session times out after an ajax request the full sigin page gets loaded into my ajax div. How can I display a modal popup instead of making a redirect when a session times out? ...

ASP .NET MVC Secure all resources

How to enable Authentication on whole controller and disable only for certain action methods. I want authentication for all resources. If I write something like that: [Authorize] public class HomeController : BaseController { //This is public [UnAuthorized] public ActionResult Index() { ViewData["Message"] = "Wel...

How to handle request-wise DB transactions in ASP.NET MVC?

I'm using SubSonic 3.0 (SimpleRepository) to handle database access in my ASP.NET MVC 1.0 application. It would be nice to handle a transaction for every web request, committing if everything went smooth and rolling back in case of exception. Is this possible? If so, how? I know this topic has been discussed many times, but I just coul...

Asp.Net Mvc JQuery ajax input parameters are null

Hi, I am trying to post some data with jQuery Ajax, but the parameters in my Ajax method are null. This is simple test to send data: var dataPost = { titel: 'titel', message: 'msg', tagIds: 'hello' }; jQuery.ajax({ type: "POST", url: "Create", contentType: 'application/json; charset=utf-8', ...

IIS 7.5 fails to open database after computer machine on that database server is working restarts.

Hi. There is a problem that bother me for some time. I have an asp.net mvc that uses NHibernate for modeling the database. The infrastructure is the following: Windows 2008 R2 for all virtual machines. IIS 7.5 is working on one virtual machine. Sql Server 2008 is working on another virtual machine. We have couple of databases, two that s...

ASP.NET MVC ActionFilter Analog for whole controller

Hi guys, Is it possible to inject behavior for whole controller, like it could be done for action with ActionFilterAttribute Best regards, Alexey Zakarov ...

StringTemplate view engine and Areas

Hello I have a problem combining StringTemplate view engine and Areas, i don't know what to do so paths can be recognized. Anyone tried that combination? ...

ASP.NET MVC - Parent-Child Table Relation - how to creat Children in MVC (example request)

Hi All. In a standard setup of Parent Child relation, lets say Project and Task. Where a Project is made up of lots of Tasks. So in a standard RDB, we have a Project (ID, Name, Deadline) Task (ID, FK_To_Project, Name, Description, isCompleted) this is all very straight forward. We have an MVC View that views Projects, so we get a ni...

ASP.NET MVC: How to display strongly typed view model, containing list of items, which also contain list of items?

Hi, I'm building an app using ASP.NET MVC which I want to use a strongly type view model, which contains a List<Item> called items which contains an id int and itemName string. The view model also conatins a List<Person> called people, and the Person class contains a List<int>. The way I want to display the information is as a table, w...

Running a server control inside an MVC view page? (asp.net)

Is this possible? if so, what adjustements do i need to make in order to do this properly. I know i can run webforms and mvc views in seperate files, but i want to run the web server control output and events in/on the mvc view page, however, i keep getting this compiler error: Line 38: <CuteWebUI:Uploader ID="UploadPic" runat="serv...

How to run a WebForms page and an MVC page in different files?

when i try to do this and load the webforms page, i get this error, even tho the path is correct. what can i do to get past this? i've tried running the aspx page from the root as well. nada. Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependenci...

Do you know why introducing jquery ui autocomplete for my dropdown boxes is also changing my listbox ?

I am trying to change my comboboxes to use autocomplete so i leverage the code listed here (which worked perfectly for my dropdowns) The issue is that i also on the same page have a listbox with the following code: <%= Html.ListBox("Cars", Model.BodyParts.Select( x => new SelectListItem { Tex...

Redirect away from HTTPS with ASP.NET MVC App

I'm using ASP.NET MVC 2 and have a login page that is secured via HTTPS. To ensure that the user always accesses those pages via SSL, I've added the attribute [RequireHttps] to the controller. This does the job perfectly. When they have successfully logged in, I'd like to redirect them back to HTTP version. However, there isn't a [Requi...

ASP.NET MVC 2 Model encapsulated within ViewModel Validation

I am trying to get validation to work in ASP.NET MVC 2, but without much success. I have a complex class containing a large number of fields. (Don't ask - this is oneo f those real-world situations best practices can't touch) This would normally be my Model and is a LINQ-to-SQL generated class. Because this is generated code, I have c...

How to map my class to get the db's records with a custom method?

I'm developing a website with ASP.NET MVC, NHibernate and Fluent NHibernate and want to know how can I customize my Map to get records using a custom Method. My entities: public class ImageGallery { public virtual int Id { get; set; } public virtual string Titulo { get; set; } public virtual IList<Image> Images { get; set; ...

Geography information

Hi, I have an application which uses geography informations. I don't want to implement this feature because I think I could find a free services which provides needed informations to me. Anybody can help me which service I could use? (Geography information means country, county, town data.) ...

In an ASP.NET MVC site, where would the JQuery code go?

I'm just getting started with ASP.NET MVC. I'm going to be using JQuery on the website I'm making, but I'm not really sure about one thing: where would JQuery code be placed? This concerns two things: Where do I import the JQuery JavaScript file? (I've been thinking that the Master page would be a good place to do this; am I right, o...

Submit Data to a datatable from a View MVC

I have a view that I would like to populate data when the next button is clicked. It is 3 Views which will send data on every next button. How do I do this? Below is code I just made up, but should give an idea of what I am looking for... Page 1: <table> <tr> <td><b>Name:</b></td> <td colspan="2"><input id=...