asp.net-mvc-2

ASP.net mvc Call Action on DropDown Value Change

扶醉桌前 提交于 2019-12-03 21:28:52
Ive got a dropdown on one of my views. This dropdown only has for entries. Basically i need to know how to call an action when the dropdown value is changed? My situation is: Im making a simple inbox page. The dropdown has the filter options: View All, View Invites, View Replies etc.. When the user selects a filter option from the dropdown I want to call to an action to return the new view with the filtered data. Any ideas? Im guessing it is somehow going to be a script attached to the OnChange of the dropdown, but i wouldnt have a clue what the syntax is or how call MVC action from the script

ASP.NET Directive Convention for Declaring Client-Side Includes

和自甴很熟 提交于 2019-12-03 21:05:31
I am loading .aspx and .ascx files as StreamReader . I want each file to register it's javascript and stylesheet dependencies in some declaration like a <%@ ClientDependency path="~/Scripts/jquery-1.4.1.min.js" %> . Is there an existing convention for doing such a thing? I don't need an implementation, but I don't want to create a new syntax if there is already a way to do it. Also, what are the guidelines for custom <%@ blocks in ASP.NET? Also, please retag this question if you can think of a more appropriate description. Have you considered Google Loader or something like this: Enabling the

Using Windows Authentication with ASP.NET MVC

核能气质少年 提交于 2019-12-03 20:51:37
I am sure this is a basic answer, but my search powers are not helping me today. I have an ASP.NET MVC 2 (.NET 3.5) application. It is hosted on IIS 6. For the sake of this question I have two urls. http://example.com/ http://example.com/admin I want admin to be available to any user on the domain, and the root to be available to all users. The server is on the domain but the domain is example1.com, so they are not the same. Since this is ASP.NET MVC there is no Admin folder to set rights on. I have tried setting the whole site to block anonymous request and have had it allowing all request.

MVC 2 with VS 2010 View Building Error: Feature 'anonymous types' cannot be used because it is not part of the ISO-2 C# language specification

纵然是瞬间 提交于 2019-12-03 20:19:03
I have a shared project where I store all of my custom EditTemplates and DisplayTemplates. This is a regular C# class library project with the views all tagged as embedded resources. The target framework of this project is ".Net Framework 4". Inside the /Views/ folder I have included this web.config file so I get MVC 2 intellisense when working with the .aspx and .ascx files: <?xml version="1.0"?> <configuration> <system.web> <httpHandlers> <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/> </httpHandlers> <pages validateRequest="false" pageParserFilterType="System.Web.Mvc

passing dropdown's selected value from view to controller in mvc3?

落花浮王杯 提交于 2019-12-03 20:12:56
I have mvc3 web application. In that i have used EF and populate two dropdownlists from database. Now when i select values from those dropdownlists i need to show them inside webgrid how can i do this? @using (Html.BeginForm()) { @Html.ValidationSummary(true) <fieldset> <legend>Mapping</legend> <div class="editor-label"> @Html.Label("Pricing SecurityID") </div> <div class="editor-field"> @Html.DropDownListFor(model => model.ID, new SelectList(Model.ID, "Value", "Text"), "-- Select category --" ) @Html.ValidationMessageFor(model => model.ID) </div> <div class="editor-label"> @Html.Label("CUSIP

CSS is not being applied after changes

丶灬走出姿态 提交于 2019-12-03 18:40:09
问题 I have problem where I can't apply the style in CSS in my ASP.NET MVC application. The behavior is it applies for the first time and then the subsequent changes to the CSS is not getting reflected in my _Layout.cshtml. I am not sure what I am missing here. CSS file body { font-size: .85em; font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif; color: #232323; background-color: #fff; } header, footer, nav, section { display: block; } /* Styles for basic forms ----------------------------

Prevent change of hidden field

那年仲夏 提交于 2019-12-03 17:38:45
问题 What if I have ChangePassword form with hidden ID field of the user. BadPerson knows id of GoodPerson. He opens Change Password form with FireBug, changes his Id to GoodPerson's Id, so password changes for GoodPerson. Of course I can create some server logic that will prevent this, but I think there should be some out of the box solution, wich throws if hidden field been changed, wich I don't know. Thank's in advance. EDIT Ok, Change Password is a bad example. Any edit form where I have id in

Technical differences between ASP.NET and Java Servlets / JSP

我与影子孤独终老i 提交于 2019-12-03 17:04:52
问题 My understanding of JSP is that every JSP page on first load is compiled into a Java Servlet. Is this the same for ASPX pages (of course, not into a servlet, but whatever the ASP.NET equivilant is)? What other technical differences should I be aware of with JSP and ASP.NET (MVC 2)? 回答1: JSP pages are translated into Java source code, then compiled into class files (containing Java Byte Code) for future execution. After that, they're actually JIT (Just In Time) compiled by the JVM when they

Optgroup drop-down support in MVC - Problems with Model Binding

核能气质少年 提交于 2019-12-03 17:01:05
问题 I wonder if anyone can shed some light on this problem.. I've got an option group drop-down for selecting a person's ethnicity – however it’s not storing the value in the model. ViewModel [UIHint("EthnicOriginEditorTemplate")] [DisplayName("Question 6: Ethnic Origin")] public int EthnicOrigin { get; set; } Helper : GroupDropList.Cs using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Mvc; using System.Web.Routing; namespace Public.Helpers { public static

ViewModels with SelectList Design Decison

一个人想着一个人 提交于 2019-12-03 16:43:16
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 CurrentPositionStartDate { get; set; } public string ReasonForDeparture { get; set; } public SelectList PositionStatusList {