Asp.net mvc 4 How can I configure Upshot to make partial updates of a ViewModel back to the server?

I have created a Single Page Application (ASP.NET MVC4) using Steven Sanderson's instructions. The issue I'm currently seeing is that whenever I edit an item and save the changes, Upshot sends the whole item back to the server and not only the modified properties as it would be expected. (I know this because firebug can inspect what is being sent to the server). I'm pretty sure that upshot should be able to send only the modified properties as it uses knockout observables so it can keep track o

Asp.net mvc 4 MVC SPA w/o EF: You must write an attribute 'type'='object' after writing the attribute with local name '__type'

So I have a very normalized model, and I'm trying to create a single page application in MVC4 which wants to use an entity framework object. My problem is I can't manage to create an entity in EF with the kind of complex mapping that I need (I have checked multiple guides, but I can't seem to make one entity from multiple tables that contain different primary keys... I found a solution using updateable views, but that's really just pushing the abstraction down to the db layer). So I thought I

Asp.net mvc 4 MVC WebApi. Want to get format of HttpResponseMessage according to current formatter

Below is my Get method of MVC Web Api RC. public Employee Get(int id) { Employee emp= null; //try getting the Employee with given id, if not found, gracefully return error message with notfound status if (!_repository.TryGet(id, out emp)) throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Sorry! no Employee found with id " + id), ReasonPhrase = "Error" }); ret

Asp.net mvc 4 How to call a WebApi controller method?

I've just created asp.net mvc 4 app and added default webapi controller public class UserApiController : ApiController { // GET api/default1 public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET api/default1/5 public string Get(int id) { return "value"; } // POST api/default1 public void Post(string value) { } // PUT api/default1/5 public void Put(int id, string value) { }

Asp.net mvc 4 Kendo UI Editable Inline

I have a problem in Kendo UI Im using GRID/INLINE EDITING using Razor, the problem is when I Click the Edit Button the textbox in Grid is not showing. This is my Code @(Html.Kendo().Grid(Model) .Name("LocalGS") .Columns(columns => { columns.Bound(p => p.Country_No).Title("Country No").Width(140); columns.Bound(p => p.Effective_date).Title("Effective Date").Format("{0:MM/dd/yyyy hh:mm tt}").Width(160); columns.Bound(p => p.Scale_Min).Width(140); columns.Bound(

Asp.net mvc 4 No Parameterless Constructor defined for - ViewModel with UOW

I have a view model class which uses UnitOfWork to some database operations like fetching of items to create select lists and IPrincipal for some auditing (like modified by etc.). It cannot work without this UOW. I have configured my web site to use Ninject to inject UOW into Controllers. From controller I pass this UOW when creating view model. But when performing POST operation I am getting No parameterless constructor defined for this object. I have few SelectList type of properties whic

Asp.net mvc 4 ASP.NET Web API - Reading querystring/formdata before each request

For reasons outlined here I need to review a set values from they querystring or formdata before each request (so I can perform some authentication). The keys are the same each time and should be present in each request, however they will be located in the querystring for GET requests, and in the formdata for POST and others As this is for authentication purposes, this needs to run before the request; At the moment I am using a MessageHandler. I can work out whether I should be reading the que

Asp.net mvc 4 Converting C# MVC-4 View to Web-Application

So i got a small aspx View on a running MVC-4 / Ext.Net 2.1 application. i want to covert it to a "Web-Application" with code-behind and designer. When first clicking "Convert to web-application" in the context menu of the View i got following Error message: Unable to convert to Web Application because Code-Behind file is missing after creating a new class named "Default.aspx.cs" and referencing it from "Default.aspx" as Code-Behind file i got the following Error message: Class 'System.Web.

Asp.net mvc 4 ASP.NET MVC4 App fails to compile Bootstrap.LESS on production while it works on dev

I feel a Little stuck right now. First I used nuget to install-package Bootstrap.less as well as install-package dotless Then, as shown in Rick Andersons Blogpost about bundling and minification in asp.net mvc, I created a LessTransform-Class. I set up 2 nearly empty .less files and created a new bundle packaging them... var lessBundle = new Bundle("~/MyLess").IncludeDirectory("~/Content/MyLess", "*.less", true); lessBundle.Transforms.Add(new LessTransformer()); lessB

Asp.net mvc 4 pluralize table names in non-english language with entity framework 5

Using asp .net mvc4, I want to have all my tables, views, controllers named in Italian language. Using EF 5 Code First I get table names pluralized with english language rules, and this is bad. Is there any place where to code custom inflection rules? I usually use Ruby on Rails for web applications, which has a very nice way to deal with this issue. Is there any similar feature in Entity Framework 5?

Asp.net mvc 4 Is it possible to run asp.net mvc 4 from within a folder of a main website?

I have successfully set up an API using ASP.NET MVC 4 on IIS6 (I used Phil's tutorial). When testing, we had it as the "Default website" and so there was no conflict with anything else. I am now being asked to set this up within a FOLDER of an existing website (the existing website is in ASP 1.0...and I cannot modify this...so I would some sort of virtual...something?). So basically, if we have https://www.ourcompany.com, they want the API to be available through https://www.ourcompany.com/api/.

Asp.net mvc 4 Hide only progressbar in uploadify

I'm creating one web application using ASP.NET MVC 4.0 and Jquery . Me use uploadify for uploading files from client and i want to upload file on post action of my form, so basically my problem is while i'm selecting file it shows progressbar with file list and uploading progressbar but i want to show only file not progress bar. stuck at this point - Any suggestion ?

Asp.net mvc 4 Passing querystrings to RedirectToRouteResult (beside controller and action)

I have the following code: var routeDictionary = new RouteValueDictionary {{"action", "Login"}, {"controller", "Persons"}}; filterContext.Result = new RedirectToRouteResult(routeDictionary); That will produce "/Persons/Login" How can I pass an aditional querystring to the previous code? so that it produces "/Persons/Login/?someQuerystring=someValue"

Asp.net mvc 4 I cannot figure out how to use the SimpleMembershipProvider.GetUserNameByEmail Method

This is a MVC 4 Internet application. I have set the Role Provider and Role Manager to SimpleRoleProvider and SimpleMembershipProvider in the Web.config file, but I continue to get the "You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class" exception despite initializing WebSecurity.InitializeDatabaseConnection in the Global,asax.cs file. I know this was initialized properly because the Roles property in the Authorize At

Asp.net mvc 4 View not found in MVC4 / ASP.net 4.5 hybrid application

Our main site is ASP.net 4.5 and uses Ektron (A .net CMS) I'm attempting to turn it into an MVC4 / Webforms hybrid. As far as I can tell I have everything MVC4 needs installed correctly but when I try to hit the default Home controller I get the classic [InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/home/Index.aspx ~/Views/home/Index.ascx ~/Views/Shared/Index.aspx ~/View

Asp.net mvc 4 Kendo MVC Grid not passing parent ID to ClientID Template, when creating Child record

I'm having a problem adding a child record in my hierarchical grid. It won't pass over the HeaderId from the parent in the grid. Can anyone spot an issue, or am I trying to do something that isn't possible? Thanks. Here's the controller action: [AcceptVerbs(HttpVerbs.Post)] public ActionResult BillDetail_Create(BillDetail billDetail, int billHeaderId) { if (billHeaderId == 0) { ModelState.AddModelError("billHeaderID", "add bill header f

Asp.net mvc 4 Exception handling in Controller in ASP.Net MVC 4 with ELMAH and ajax

I've seen a number of posts and articles but am not able to see the solution crisply. I've installed Elmah.MVC via NuGet and have commented out this line from FilterConfig.cs: //filters.Add(new HandleErrorAttribute()); So that Elmah would pick up the errors. It works when I provide an invalid action name and I get a yellow page as well as an email. I want to know about two other types of errors that my code may generate... how are we supposed to handle them: 1.E.g. if my repository or man

Asp.net mvc 4 custom route .net MVC 4

I'm trying to wrap my head around some custom routing but I'm getting 404s when I try to access my site. I've tried both of these in my global.asax public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( name: "Show", url: "{controller}/{action}/{trip}/{year}/{user}", defaults :new { controller = "Home", action = "Show" } ); } and public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( "Default",

Asp.net mvc 4 Adding id to mvc4 dropdownlist

This is my code: @Html.DropDownListFor(m=> m.IsCurrentlySmoking, new{ onchange="RiskChange(this)", id="IsCurrentlySmokingLeftDrp", SelectList(new List<Object>{ new { value = 0, text = "Fortsatt rökning"}, new {value = 1, text = "Minskat rökning"}, new {value = 2, text = "Röker ej"}, }, "value", "text", 0)} The code worked fine untill i added the id to it. Now i get the error: CS0746: Invalid anonym

Asp.net mvc 4 DropDownlist value is inserted as System.Collections.Generic.List`1[System.Web.Mvc.SelectListItem]

I'm trying to insert value of dropdownlist in db but instead of storing its selected value it is storing this value System.Collections.Generic.List1[System.Web.Mvc.SelectListItem]. Here is my code. View: @Html.DropDownListFor(m =>m.propertyType, (List<SelectListItem>) ViewData["property"]) Model: public string propertyType { get; set; } [HttpGet] public ActionResult EditProfile() { List<SelectListItem> items = new List<SelectListItem>();

Asp.net mvc 4 System.NullReferenceException: Object reference not set to an instance of an object. bootstrap dropdownlist

Model public class Employee { public int EmployeeID { get; set; } public string Title { get; set; } [Required(ErrorMessage = "Please enter first name.")] [StringLength(500)] public string FirstName { get; set; } public string MI { get; set; } [Required(ErrorMessage = "Please enter last name.")] [StringLength(500)] public string LastName { get; set; } public string Gender { get; set; } [Required(ErrorMes

Asp.net mvc 4 Session is null in MVC4 after OAuth Callback

My Controllers derived from my BaseController, it implements ExecuteCore to make OAuth requests. I send Callback (i.e. /Test/CallBack) within the request and save some data in Session. It prompts a page from Provider to Allow or Deny accessing data on Provider server. I click on Accept and it redirects me to /Test/CallBack. In this action method I am trying to get data from Session but session is empty (it is not null, it has lost my data). why? thanks. OBS: I have tested and added SessionState

Asp.net mvc 4 Trying to Understand MVC4/Razor syntax and why things don't appear

It's clear that when I have a block like the following that no matter what @Model.ShowBottomBarOverride is set to, the div in the {} does not render. I think it should but I just don't get it. I'm sure I'm somehow not understanding razor syntax processing @if (@Model.ShowBottomBarOverride) { <div id="sponsorBottomBar" class="hideOnSmallScreen"> @{ Html.RenderPartial("_SponsorsBottomBar", Model); } </div> } <

Asp.net mvc 4 MVC4: dynamically change route value from dropdown list selection

I have a dropdown list that serves as a record navigation control -- selecting a value from the dropdown is supposed to "jump to" that record. I feel like I've done stuff like this before that worked, but I can't get this one to work. The issue seems to be that I can't get the dropdown list to change the ID route value that the page was initially called with. So let's say my page is called from this URL: /PatientProfile/Services/12 12 is the ID route value here--this is essentially the initia

Asp.net mvc 4 why do i have to keep doing iisreset for my mvc4 app on iis6 to work?

I have an mvc4 app working fine on my dev box(windows 7 iis 7)...moved the app to staging(windows server 2003 iis6). After a lot of research found out various options for getting this to work as per here: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx and here: http://blog.stevensanderson.com/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/ The site works well with the wildcard option but after a few hours the guys testing kept complaining that the app took fo

Asp.net mvc 4 Web Api MVC binding FormDataCollection

I have a Jquery Ajax call more or like below $.ajax(url, { type: httpMethod, contentType: "application/json; charset=utf-8", data: '{name:"abc",age:23,address:"29 judd ce"}', The web api action is public HttpResponseMessage Post([FromBody] FormDataCollection data) { However the parameter 'data' is always null. Is this a web api limitation or am i doing it the wrong way Thanks

Asp.net mvc 4 ASP.net MVC4 how to seperate usercontext and datacontext in single database?

When I was taught mvc4 I was taught with this approach: usercontext handles all user profiles datacontext handles all persistent data for the app This means my applications has 2 classes derived from context; the user and the data. This worked fine until I started building more applications and ran into the problem where I needed to instantiate the UserContext class to get properties from the user like their first name or email address. When instantiating the UserContext object on localhost

Asp.net mvc 4 Unable to post checkbox value to my controller

Unable to post Checkbox value to my controller. regarding the same question i read in your blog "Getting Checkbox Value in ASP.NET MVC 4", but doesn't meet my requirement.. I'm using Html Helpers in my view and this view is strongly Typed View of type TaskViewModel Here point is according to my requirement we should make property IsActive as HiddenInput Attribute and it is of type boolean in my TaskViewModel class, if I use this EditorFor Extension to my IsActive Property then the checkbox

Asp.net mvc 4 MVC create record

View Code: @model EI.Models.QuoteModel @using (Html.BeginForm()) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) //a bunch of input fields <input type="submit" value="Create" /> } Controller code: public ActionResult Create(QuoteModel qm) { if (ModelState.IsValid) { db.QuoteModels.Add(qm); db.SaveChanges(); return RedirectToAction("Index"); } return View(); } I fill out the fields on the v

Asp.net mvc 4 MVC application with case and switch

I am building an MVC 4 application and i am trying to disable one TextBoxFor (or add some text) if another TextBoxFor has been entered. Was trying to use switch-case statement but so far no luck. Because i have to add text/disable other TextBoxFor this has to be run in runtime. Part of the Create View code: <div class="editor-label2"> @Html.LabelFor(model => model.First) </div> div class="editor-field2"> @Html.TextBoxFor(model => model.First, new { @id = "id1"} )

Asp.net mvc 4 how to edit the attachment file in ASP.net MVC4

I have created a list of project in CRUD operation, in which I have successfully created a list of projects with uploading attachment. My problem is that when I update the project list. I am unable to read the inserted file and unable to upload the attachment file. Businees Access Layer Code is public bool UpdateProject(ProjectInfoModel upd) { try { int ProjectID = upd.ProjectID; string ProjectCode = upd.ProjectCode; string ProjectName =

Asp.net mvc 4 Getting Parser Error when adding Razor to HTML

I am trying to add razor to my HTML but now I am getting a Parser Error and do not understand why I get this error: HTML: @model ServingTeam.DAL.Members @{ ViewBag.Title = "New Member"; Layout = "~/Views/Shared/_Layout.cshtml"; } @using (Html.BeginForm("AddMember", "Home", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { role = "form" })) { <div class="row"> <div class="col-md-2"> </div> <div class="col-sm-6"> <h2>

Asp.net mvc 4 "Entry has already been added" - Two Separate App Pools

I am creating a test version of an existing production site. A virtual web service application exists inside the site - and the two web configs have the same connection string. There are no "clear" tags in the production web configs and the site and the web service co-exist merrily on two separate app pools. On the test site however, every time I browse to the webservice URL I receive the Configuration Error "The entry 'ConnectionString' has already been added." The test site and correspondi

Asp.net mvc 4 Can we use Code first approach migration with oracle

I am using mvc4 and Entity framework-5. I wanted to implement Code first approach migration with oracle. If yes please suggest what is the basic step need to follow. Please don't suggest below url. i have followed "B" step and getting "No MigrationSqlGenerator found for provider 'Oracle.ManagedDataAccess.Client'" http://stackoverflow.com/questions/13721025/deploying-and-configuring-odp-net-to-work-without-installation-with-entity-frame

Asp.net mvc 4 Routing in BackboneJs, involving Jquery Mobile and Asp.Net MVC4

I'm trying to use backbonejs as my router, routing does not seems to work for subpath nor splat. I'm using MVC 4 together with Jquery mobile for this project and hopes it does not cause conflict in the routing. The result of testing are below: http://localhost gives me "Routed to home" in console. (correct) http://localhost/#contacts gives me "Routed to contacts list" in console. (correct) http://localhost/#contacts?1 stills gives me "Routed to contacts list" in console. (wrong) http://loc

Asp.net mvc 4 MVC4 ViewData.TemplateInfo.HtmlFieldPrefix generates an extra dot

I'm trying to get name of input correct so a collection of objects on my view model can get bound. @{ViewData.TemplateInfo.HtmlFieldPrefix = listName;} @Html.EditorFor(m => m, "DoubleTemplate", new { Name = listName, Index = i, Switcher = (YearOfProgram >= i +1) }) As you can see here, I pass in the "listName" as the prefix for my template, the value of listName = "MyItems". And here

Asp.net mvc 4 Web API 2 return OK response but continue processing in the background

I have create an mvc web api 2 webhook for shopify: public class ShopifyController : ApiController { // PUT: api/Afilliate/SaveOrder [ResponseType(typeof(string))] public IHttpActionResult WebHook(ShopifyOrder order) { // need to return 202 response otherwise webhook is deleted return Ok(ProcessOrder(order)); } } Where ProcessOrder loops through the order and saves the details to our internal database. However if the process takes too long then the webhook

Asp.net mvc 4 How to Deny access to one page when you are not logged in MVC 4?

I have a non logged web application that contain 50 pages, I need to have one logged page "testpage" How can do this: <authentication mode="Forms"> <forms loginUrl="~/Login/LoginExpiration.aspx" defaultUrl="~/Home/Default.aspx" slidingExpiration="true" timeout="120" /> </authentication> <authorization> <allow users="?" /> </authorization> <location path="testpage"> <system.web> <authorization> <deny users="

Asp.net mvc 4 What's the best way to create a confirmatin modal window in asp.net mvc?

What is the best way to create a confirmation modal window in asp.net mvc 4? Currently I have: if (ViewBag.deleteIsVisible) { <button onclick= "if(confirm('Are you sure you want to Delete?')) location.href='@Url.Action("Delete", "Home", new { Id = Model.id })'; else return false;" >Delete</button> } But I don't really care for the old school looking javaScript box. I was hoping to have more control and make a little more rich content by having a display box like

Asp.net mvc 4 I want to show error message when textbox is null in mvc4

I am new in ASP.Net MVC 4. I have one textbox and one button. I want to show the error message when textbox is null after clicking on the button. can anyone help me. My Account class is: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.Security; namespace WebApplication6.Models { public class Account { [Required(ErrorMessage = "Please enter your name {0}"

Asp.net mvc 4 asp mvc 4 passing a long string

I currently have a view containing a form. In the form there is a link which allows the user to view one of the textboxes in a separate tab/window. My question is how do I retrieve the text from that textbox and pass only that text to a controller? Currently I have the below code (which returns: The request filtering module is configured to deny a request where the query string is too long ) View @using (Html.BeginForm("PostValuation", "Property", FormMethod.Post, new { enctype =

Asp.net mvc 4 Is there any reason to have multiple ScriptBundle bundles in BundleConfig?

Here, the default MVC5 App BundleConfig: public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate*")); // Use the dev

Asp.net mvc 4 I want to ignore duplicate values from datatable.

I want to ignore duplicate value and only want to get distinct value from data table. Please help me my code foreach (string csvRow in ReadCSV.Split('\n')) { if (!string.IsNullOrEmpty(csvRow) && csvRow.Length == 11) { for (int i = 0; i<tblcsv.Rows.Count;i++ ) { if (ReadCSV[i].Equals(tblcsv.Columns.ToString())) continue; } tblcsv.Rows.Add()

Asp.net mvc 4 ajax error 500 & Internal Server Error in MVC

I used ajax method to call the controller and fetch the data and convert it to json or list and set a jquery DataTable. With 1000 records it's working fine, but when I fetch more than 5000 records, ajax method gives me: 500 Internal server error Here is my code: $('#btnAllData').click(function () { $.ajax({ url: 'PartMaster/GridLoad', contentType: "application/json; charset=utf-8", dataType: "json", success: function (Result) { debugger;

Asp.net mvc 4 How to move MVC application from one server to another?

Currently we are subscribed to GoDaddy for their dedicated server lease, and now we are considering just purchasing our own server and just moving off of GoDaddy. I have no idea how to put all of my source code from one server to another and also move the database and other files. Please explain what process has to be followed for this. Also wanted to ask if their would be any changed for the third party tools i have used in my application?

Asp.net mvc 4 How to send parameters to JavaScript function from inside of a ClientTemplate of a Kendo.Grid?

My view has a Kendo Grid with a ClientTemplate defined for a column in the following way: .ClientTemplate("<button type ='button' class='k-button btn-icon-sm btn-view-detail' id='btnTicketDetail' onclick='showDetails(this)'><span class='k-icon k-i-file-txt'></span></button>#=data.TicketId#"); The above code calls JavaScript function showDetails This function is defined in the same view as a Kendo Grid: function showDetails(e) { var grid = $("#Variance

  1    2   3   4   5   6  ... 下一页 最后一页 共 30 页