asp.net-mvc-2

how to disable the multiple selection from the list box using jquery? or javascript?

北慕城南 提交于 2020-01-13 02:39:22
问题 I have a list box in my page.. <td><%=Html.ListBox("listServiceTypes", Model.ServiceTypeListAll, new { style = "width: 500px;height:200px;" })%> I need to disabled selecting multiple items from the list box? I am doing something like selecting one item and click delete button my page its delting one item from list box.. but If I select multple Items its throwing an error message/.? Can any body help me out how to deactive or disable multiple items from list box 回答1: You could do that with the

Asp.Net MVC2 Clientside Validation problem with controls with prefixes

狂风中的少年 提交于 2020-01-13 02:14:27
问题 The problem is: when I put 2 controls of the same type on a page I need to specify different prefixes for binding. In this case the validation rules generated right after the form are incorrect. So how to get client validation work for the case?: the page contains: <% Html.RenderPartial(ViewLocations.Shared.PhoneEditPartial, new PhoneViewModel { Phone = person.PhonePhone, Prefix = "PhonePhone" }); Html.RenderPartial(ViewLocations.Shared.PhoneEditPartial, new PhoneViewModel { Phone = person

HiddenInput(DisplayValue = false)] vs [ScaffoldColumn(false)]

拟墨画扇 提交于 2020-01-12 14:03:14
问题 What is Exaclty ScaffoldColumn(false) and HiddenInput(DisplayValue = false) ? And What are the main difference between these two ? Which one is best to use?? Thanks!!! 回答1: [ScaffoldColumn(false)] tells Visual Studio not to scaffold the column when generating a template for your view. When you create a new view, you can create a strongly typed view. When you do that Visual Studio asks you what template to use (Create, Edit, List, etc). If you create an Edit/Create template; for example, if

ViewModels with SelectList Design Decison

女生的网名这么多〃 提交于 2020-01-12 09:15:55
问题 I have created a viewmodel public VMPosition { public VMPosition(){}//for model binder public VMPosition(int EmployeeID) { PositionStatusList = new SelectList(_repo.getStatuses); //populate other properties } public int CurrentPositionID { get; set; } public int EmployeeID { get; set; } public int CurrentPositionHistoryID { get; set; } public bool AddingNew { get; set; } public bool ClosingCurrent { get; set; } public string CurrentPosition { get; set; } public DateTime

ViewModels with SelectList Design Decison

社会主义新天地 提交于 2020-01-12 09:15:35
问题 I have created a viewmodel public VMPosition { public VMPosition(){}//for model binder public VMPosition(int EmployeeID) { PositionStatusList = new SelectList(_repo.getStatuses); //populate other properties } public int CurrentPositionID { get; set; } public int EmployeeID { get; set; } public int CurrentPositionHistoryID { get; set; } public bool AddingNew { get; set; } public bool ClosingCurrent { get; set; } public string CurrentPosition { get; set; } public DateTime

MVC 2.0 dynamic routing for category names in an e-store

坚强是说给别人听的谎言 提交于 2020-01-12 07:56:06
问题 I'm currently working on an e-store using ASP.NET MVC 2.0. I already got most of it up and running, but the part that's been bothering me is routing. I want this: http://mystore.somewhere/my-category-1/ So far I've been able to solve it by using: routes.MapRoute( "Category", "{alias}/{pageNumber}", new { controller = "Categories", action = "Browse", pageNumber = 1 }); But this catches way too much than just what I'd like. After reading through some questions and answers around this site, I

Issue with MvcContrib TestHelper Fluent Route Testing and Specific HttpVerbs

ぐ巨炮叔叔 提交于 2020-01-11 10:48:42
问题 I'm attempting to use the MvcContrib TestHelper fluent route testing API, but I'm seeing odd behavior. The .WithMethod(HttpVerb) extension method does not seem to be executing as expected. Here's my controller showing (2) actions (identically named) that accept different HttpVerbs: [HttpGet] public ActionResult IdentifyUser() { return View(new IdentifyUserViewModel()); } [HttpPost] public ActionResult IdentifyUser(IdentifyUserInputModel model) { return null; } And here is the test that should

Sql Server 2012 store pdf [closed]

為{幸葍}努か 提交于 2020-01-11 09:38:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How to store PDFs file in database and how to show preview using the asp.net. the PDFs file is uploaded by control and then i need to show preview afterward i store into the database. <input type="file" /> 回答1: Generally, you can choose one of the following techniques: Upload the file in specific folder in your

ASP.NET MVC 3 Partial View in layout page

∥☆過路亽.° 提交于 2020-01-11 00:55:09
问题 I'm working on setting up a shared content (navigation) for an asp.net MVC layout page. Here is my partial view "_LayoutPartial.cshtml" with code to pull navigation data from a model. @model MyApp.Models.ViewModel.LayoutViewModel <p> @foreach (var item in Model.navHeader) { //Test dump of navigation data @Html.Encode(item.Name); @Html.Encode(item.URL); } </p> Here is how the code for my controller "LayoutController.cs" looks like. using System; using System.Collections.Generic; using System

.NET 4 MVC 2 Validation with annotations warning instead of error

半城伤御伤魂 提交于 2020-01-10 10:40:10
问题 I am using .NET 4 with MVC 2 for validating with Annotations. Is there a (simple) solution for giving back a warning instead of the error ? So that I am able to get a green or yellow box with a message like "you should not use this content, but you may". Big thanks in advance! :) EDIT: Please observe that I am already able to throw out errors via ErrorMessage but I additionally want something like WarningMessage or InfoMessage so that the user only gets a warning but might proceed. Is there a