asp.net-mvc

Query data using LINQ to SQL and Entity Framework with foreign key? (Help me please)

Hello! There is a problem I need help with your query on the data using LINQ to SQL and Entity Framework (I'm using Visual Studio 2010). My picure here: http://img.tamtay.vn/files/photo2/2010/5/28/10/962/4bff3a3b_1093f58f_untitled-1.gif I have three tables: tbl NewsDetails tblNewsCategories tblNewsInCategories (See screen 1 in my ...

Edit and Continue does not Work in VS 2010 / ASP.Net MVC 2

Although Enable Edit and Continue is checked on the Web tab of my ASP.Net MVC 2 project, I cannot in fact change the source code while running. For example, if I try to edit a controller while paused in the debugger, I cannot change the file (acts as if read only). I found a related post Edit and continue in ASP.NET web projects, howev...

what are some key differences between mvc1 and mvc2

what are some key differences between mvc1 and mvc2. I have to adopt any one so i am unable to decide that is mvc2 have some really good features that mvc1 is missing. ...

Need an ASP.NET MVC long running process with user feedback

I've been trying to create a controller in my project for delivering what could turn out to be quite complex reports. As a result they can take a relatively long time and a progress bar would certainly help users to know that things are progressing. The report will be kicked off via an AJAX request, with the idea being that periodic JSON...

Pass Date object from javascript to asp.net mvc controller

Hi, I have a Date variable in client side and I want to pass the Date variable to my controller at server side. I have passed as a normal field and the date is defaulting to 01-01-0001 12:00:00 AM. help me to convert the date field with the right format. ...

mvc 2.0 xval Validation summary for two controls

I got small problem with validation summary : When I have two two control on page all summary validation information goes to first control validation summary element, even xval generated script say that elementID are different for summary. Any one know how to repair it? Here is link for sample project http://www.sendspace.com/file/m9g...

A c# Generics question involving Controllers and Repositories

I have a base repository class which contains all the common repository methods (as generic): public abstract class BaseRepository<T, IdType> : IBaseRepository<T, IdType> My repositories from this base e.g.: public class UserRepository : BaseRepository<User, int>, IUserRepository I also have a base controller class containing comm...

Asp.net MVC dynamic generated Text Boxes

I am creating a page with with some Text Boxes that are generated dynamically. Ids' of all text boxes are also generated at run time. I want to send all text boxes value to my controller and save that data. How I get all text boxes value. I may use javascript or JQuery. Can anyone suggest me? Thanks in advance.. Ashish ...

specified size of td

<table class="data-table"> <tr> <th style="width: 200px;"> DescriptionDescription <%--in this case <td> is resized--%> </th> </tr> <% foreach (var item in Model) { %> <tr> <td style="width: 200px;"> <%= Html.Encode(item.Description) %> </td> </tr> <% } %> </table...

In ASP.NET MVC Should A Form Post To Itself Or Another Action?

Which of these two scenario's is best practice in ASP.NET MVC? 1 Post to self In the view you use using (Html.BeginForm) { ... } And in the controller you have [HttpGet] public ActionResult Edit(int id) [HttpPost] public ActionResult Edit(EditModel model) 2 Post from Edit to Save In the view you use using (...

How to add custom hooks to controllers in ASP.NET MVC2

Hi, I've just started a new project in ASP.net 4.0 with MVC 2. What I need to be able to do is have a custom hook at the start and end of each action of the controller. e.g. public void Index() { *** call to the start custom hook to externalfile.cs (is empty so does nothing) ViewData["welcomeMessage"] = "Hello World"; ...

how to autogenerate random password in asp.net mvc application

how to autogenerate random password in asp.net mvc application ...

Should I create an interface for each Model?

Hey everyone I'm just getting started with Dependency Injection (DI) using Ninject and am working through my controllers looking to decouple them from my models a bit more. At the moment, inside of my controllers I am creating an instance of some given model e.g: var activitiesModel = new ActivitiesModel(); For each of my models tha...

asp.net mvc file getting only file name

i am using asp.net mvc ,once i upload the file how would i get the file name only in the controller? ...

Can I constrain a route parameter to a certain type in ASP.net MVC?

I have the following route: routes.MapRoute( "Search", // Route name "Search/{affiliateId}", // URL with parameters new { controller = "Syndication", action = "Search" } // Parameter defaults ); Is there a way I can ensure "affiliateId" is a va...

Using #DEBUG macros in spark

I have some scripts which need to be included only in the release version. Stuff like google analytics, quantserve etc. The typical way in asp.net mvc world is to wrap a #if DEBUG #endif How do I do it the sparkish way. Like <script if='x==5' type="text/javascript"> ...

Newbie question on MvcContrib TestHelpers

Hi, I'm just starting to use the TestHelpers in MvcContrib. I want to try and test an action method on my controller that itself tests if IsAjaxRequest() is true. I've used the same code that is shown in the TestHelper samples to set up the TestControllerBuilder _controller = new StarsController(); _builder = new TestControllerBu...

Custom membership provider via WCF authorization question

I've made a global authentication via WCF to use with the most of our systems, but found that load data via WCF not very so fast. What I need to do now is verify every time that the page is loading if the user has access granted to that page.... Its a good pratice to go back in WCF request this info for every page that the user access?T...

Localize DisplayNameAttributes in ActionFilter?

Is it possible to access the DisplayNameAttributes that are used on my ViewData.Model so I can Localize them before sending them to the view? Something like this: Public Void OnActionExecuted(ActionExecutedContext: filterContext) { foreach (DisplayNameAttribute attr in filterContext...) { attr.TheValue = AppMessages.GetLocazation(...

Which validation framework is better?

Does anyone have any recommendations for either of these validation ASP.Net MVC Validation frameworks? xVal: http://xval.codeplex.com/ FluentValidation: http://fluentvalidation.codeplex.com/documentation NHibernate.Validator DataAnnotations by the way: my project use sharp-architecture ...