asp.net-mvc

What is the proper way of using DTOs in this case?

I have the following domain class: public class Product { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual IList<Product> RelatedProducts { get; set; } } I have the following DTO class: public class ProductDTO { public ProductDTO(Product product) { Id = product.I...

MVC2 Multiple Model definition from linq to sql class VB.net

I call upon the VB ninjas out there. Here's my situation. I need to eventually be able to pass multiple models to a view. Currently I have a linq to sql class that, of course, has a bunch of generated model definitions. I need to make a model that implements multiple models. I somewhat understand how to do this in C#, but this project is...

Export files for xcopy installation of ASP.NET MVC project

I have an ASP.NET MVC project that I'd like to install somewhere using xcopy (as opposed to an installer). How do I export/build to a folder that I can copy straight to the IIS environment? I think at work we use a web deployment project but that's a plugin and I was wondering if there's another way? ...

asp.net mvc and jquery datepicker ui data fetch on clicking on specific date

I'm using the jQuery UI datepicker to display the daily exchange rate. I have four textbox, the first for displaying today's date, and the others for displaying the dollar rate, buying rate and selling rate. The dollar rate is fixed and is set to 1. The buying rate and selling rate are updated daily and inserted into exchange rate table ...

Is it better to return the most specific or most general type from an action method?

What are the benefits or detriments of either? ...

How to make these 2 blocks of almost identical code reusable?

I need advice on what I need to do to make the following two blocks of code reusable. I have to produce another table of funds and while I'm doing that, I'd like to create FundsTable.ascx partial view that all Views that need to display a fund table can use. // Inherits="System.Web.Mvc.ViewPage<CompanyViewModel> // this is a company <%f...

Embed raw data in HTML to parse in jQuery

I've been living in the desktop world for most of my career, so forgive me for asking such a basic question, but I'm not quite sure where to start looking. I want to return some raw data along with my HTML, and parse and display the data using jQuery as soon as the HTML is ready. I know roughly what my js code should look like, but I'm ...

What is causing this DatabaseFileLockedException when trying to open a db4o database in an ASP.NET MVC app?

I'm building a small web application with ASP.NET MVC 2, using db4o as a datastore. I have added an HttpModule—as per the example here—to give the application access to the db4o database, and everything is working perfectly on my development machine under the VS2008 ASP.NET Development Server. However, when I deploy the app to my web h...

Using ASP.NET MVC 2, StructureMap, Fluent NHibernate, and PostgreSQL

I am using the above combo in a new web app Im doing just to try to learn to build new stuff to expand my knowledge. Im hoping to go live if I do a good job.. Im kind of new at MVC and the other products so I was trying to find a link to a good tutorial that set all of these up together. If anyone knows of one or maybe 2 that set up 3 of...

LINQ query to delete particular record

I need to delete a record from the table For one CategoryId I will have several serviceTypes.. Ex: CategoryId = 123 Service types related to this is 1 2 3 4 5 I need a query to delete servicetype 3 to CategoryId 123.. My method will be I will pass Deleterecord(CategoryId,ServiceTypeId); ...

ASP.NET MVC application security

Today i test my ASP.NET MVC web-application and i find out anyone can easily submit a form of our website without coming on my website? Ex: example.com/home/test [HttpPost] public ActionResult Test(string name) { return View("home"); } <form id="myForm" method="post" action="example.com/home/test"> <input type="text" name="n...

What is the difference if a Views' "head" tag has attribute "runat" or not?

When I create any views in my application in ASP.NET then I see that <head runat="server"> If I change it to <head> what is difference between these two conditions? ...

ASP.NET MVC View throwing CS1061 error related to type of model object passed as ViewDdata to a view

I'm working through the ASP.NET MVC article at http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx. (Note: Some of the constructs in this post were deprecated in MVC 1 RTM, so I've changed the code accordingly. Perhaps that's my problem.) In my LINQ to SQL .dbml (in MyDB.designer.cs) the Category class ...

display tabpanel based upon permission.

Hello All i am doing project in ASP .Net MVC 1.0.I want to display tabpanel based upon permission.i.e. i have written function which will return boolean value and based upon that value i want to display tab panel on my view page.My database contains velue for UserBrowseTab only <%if(Utilities.checkPermissions(1, "...

What separates self taught from trained professional devolpers?

I've been developing with C#/ASP.NET (and now ASP.NET MVC) for several years. I'm 100% self taught, and I'd like to believe I try to do what's best practice, but... My question is, what do you think separates self taught developers from trained professional developers? What techniques, in C#, would you consider advanced - that self taug...

How to put a jQuery click event on a checkbox in a grid in ASP.NET MVC 2

I am displaying a list of data in the following manner; Surname Forename Email Address Email Distribution Ops Manag...

Is it possible to access a profile without updating LastActivityDate?

In asp.net (using MVC, but this happens in regular too) Profile.GetProfile(username); will update the LastActivityDate for that user. This is not intended when someone else is viewing that user's profile. In the membership class you can specify whether to update this date with a second param, like so: Membership.GetUser(username, fa...

Dto and domain entities. Did I create my dto correctly?

I have the following domain entity: public class CartItem { public virtual Guid Id { get; set; } public virtual Guid SessionId { get; set; } public virtual int Quantity { get; set; } public virtual Product Product { get; set; } } I have the following DTO: public class CartItemDTO { public CartItemDTO(CartItem c...

Problem posting file through jquery in asp.net mvc

I want to check file size and file type when someone choose a file from file upload so for that i use $('#fuEnglish1').live('change', function () { var form = $("#form11").serialize(); var myurl = '<%= Url.Action("CheckFileSizeandType", "Media") %>'; $.ajax({ url: myurl, type: "POS...

ASP.NET MVC2 RenderAction makes parent loose ViewModel context

I'm my Project Browser page I have 2 sub-elements that warrant their own controller (and not simply a user-control) - Upload and FileBrowser, and so I've added them using Html.RenderAction(Action, Controller, param). The problem however, is that the Browse page requires ProjectViewModel, where Upload uses UploadViewModel, etc. etc. So b...