asp.net-mvc-2

Partial View click event not fire

最后都变了- 提交于 2019-12-10 20:33:57
问题 My *.aspx Page (main page): function getEmployeeHours(employeeId,year,month) { $('#clocked-details').load('/Employees/GetEmployeeClockedHours/',{ 'employeeId': employeeId,'year': year,'month': month }); }; My partial view *.ascx : <td> <button id="btnSave" type="button" class="actionButton"> Save</button> </td> As above code snippet I need to accsess partial view btnSave from main view to trigger click event. I have written below code inside the main view. $('#btnSave').off('click').on('click

jQuery generic code

帅比萌擦擦* 提交于 2019-12-10 18:19:22
问题 I am using jQuery modal dialogs in my app to handle normal CRUD operations. In some cases I have even two stacked modal dialogs open. I have then created two generic function in an external javascript file to handle respectively the showing and the submit of CRUD forms. To show modal dialogs I call the following function function _loadDialog(level, action, id, title, onCloseHandler) { var panel = panels[level]; $(panel).dialog("option", "title", title); var url = action; if (id != "") url =

VS 2008 Web Deployment - prevent folder from being deleted

自作多情 提交于 2019-12-10 18:17:35
问题 I have an ASP.NET MVC 2 project that is built and then deployed using a web deployment project (Visual Studio 2008). The site has an uploads folder in the root of the site where user generated images are saved to. Whenever the build is run (using team city) the uploads folder is deleted meaning any previously uploaded images are deleted for good. Is there anyway in the deployment project that i can tell it not to delete this folder? Or will i have to copy it out prebuild and copy it back in

ASP.NET MVC 2: View Subfolders?

巧了我就是萌 提交于 2019-12-10 17:51:07
问题 It seems to me that as I'm working with View and Controllers, that Controllers only handle the first level of their respective folder. /Controllers/MembersController /Views/Members/ How is the Controller supposed to handle sub-folders? /Views/Members/Business 回答1: The Controller isn't . If you want a page at the url /Views/Members/Business/ThePage , you'll solve that with a route definition in your global.asax.cs. If you need to put views in subfolders for organization, you should consider

Migrate from .NET MVC 1 to MVC 2 RC

ⅰ亾dé卋堺 提交于 2019-12-10 17:34:35
问题 I've migrated a MVC1 project to MVC2 RC, and now the site doesn't work at all. I get the error "Entry point was not found." I migrated the project following this link I'm using Castle Windsor as DI. Here is a part of global.asax.cs public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Main", action = "Index", id = "" }); } protected void Application_Start() {

From AutoMapper to Emit Mapper

妖精的绣舞 提交于 2019-12-10 17:29:37
问题 I've recently discovered AutoMapper for bridging ViewModels and my actual DB objects. I use it in the way decribed here: http://automapper.codeplex.com/wikipage?title=Projection&referringTitle=Home I've discovered Emit Mapper to :), but I can't find anytning similar to (where I can specify custom projecting rules): .ForMember(dest => dest.EventDate, opt => opt.MapFrom(src => src.EventDate.Date)) Thanks in advance! 回答1: For the Record this is the best solution that I came across on how to do

Asp.Net MVC - Common Data Across All Controllers

烈酒焚心 提交于 2019-12-10 17:27:56
问题 The setup: (using Asp.Net MVC 2 RC, Entity Framework, SQL Server, VS2008) My buddy and I are working on a project that will have different domains pointing at it. We want to get the domain (website) out of the Request and use that to drive data. This website data needs to be part of all the controllers. Ex. Data for domain1.website.com will be different than data for domain2.website.com, and those will be different than data for website2.com. The look of the site is the same for all these,

Custom Validation Attribute is not called ASP.NET MVC

匆匆过客 提交于 2019-12-10 17:26:30
问题 Hello everyone I have create custom validation attribute and assign it to class level validation. Unfortunately, it is not called. I try every way that it think it could be solve the problem. However, it take me for hours and I can't find the attribute is not called by validation mechanism. For illustrate you I put the following code. Attribute [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public sealed class BooleanDependencyAttribute : ValidationAttribute

In ASP.NET MVC 2, can I deserialize a querystring into an array using the default ModelBinder?

為{幸葍}努か 提交于 2019-12-10 17:12:00
问题 In ASP.NET MVC 2, you can use this URL and this controller method: GET http://server/controller/get?id=5 public ActionResult Get(int id) { ... } And the ModelBinder will convert the id=5 querystring to id = (int) 5 in the method parameter. However, this won't work: GET http://server/controller/get?idlist=1,2,3,4,5 public ActionResult Get(int[] idlist) { ... } idlist will be null in the parameter. Although the parsing for this is pretty trivial, I was wondering if there is a way to either

Posting int arrays to MVC controller - what would be the correct method signature?

馋奶兔 提交于 2019-12-10 17:04:54
问题 Below is a screenshot of the POST request (using Firebug Net panel) I am sending to my ASP.NET MVC2 controller. This is the controller / action method that receives the POST request: public ActionResult Search(int[] skill, int[] discipline, int[] education, int[] marketsector){ ... } The parameters POSTed seem to me to be in the correct form, however the action method receives four null arguments. Could you please tell me what should the method signature look like on the server side? Or a