FAQ Database Discussion Community
c#,asp.net-mvc-5,silverlight-5.0
I decided to convert the WPFs into a Silverlight applications. My only problem is trying to get it to display the silverlight application in my MVC web browser. I added all of my silverlight projects into my MVC project. I am just not getting it to show my silverlight application....
knockout.js,asp.net-mvc-5,web-api
The solution was the same as in this question: How to get an observableArray's length? ...but the question itself is unique so anyone in the same situation will hopefully have an easier time finding the answer than I did. I'm fairly new to Knockout and to Web API. I've built...
c#,asp.net-mvc-5,entity-framework-6
I've recently been learning asp.net MVC 5 and EF6 and i've started to develop viewmodels for my views instead of stuffing values into the viewbag. I this is my viewmodel called EmployeeCreate namespace Rota.ViewModels { public class EmployeeCreate { public string FirstName { get; set; } public string LastName {...
c#,asp.net-mvc,asp.net-mvc-5
In MVC 5 I am attempting to use the controller to render a partial view only if the (Windows Authenticated) user belongs to one or more of a list of Active Directory groups. There are over 30 distinct groups I need to account for, so the "hello world" examples don't...
c#,asp.net-mvc-5
<form name="mailform" id="mailform" method="post" action="@(ViewBag.Test)" class="testForm"> What I thing that this will render my action attribute like action="" (in case of ViewBag.Test = null) but I am confused with ASP.NET MVC's behaviour. When ViewBag.Test is not defined than my action attribute is not rendering. For confirm I open the View-source...
c#,asp.net,asp.net-mvc,asp.net-mvc-5,asp.net-mvc-routing
I have the following controller public class GlobalAdminController : Controller { // GET: GlobalAdmin [AuthorizeUser(Roles = "admin")] public ActionResult Index() { return View(); } } And the home controller which is the main landing page for the app public ActionResult Index() { if(User.IsInRole("admin")) { RedirectToAction("Index", "GlobalAdmin"); } return View(); }...
c#,asp.net-mvc-5,ado.net-entity-data-model
i have done lot of attribute validation on Models in EDMX entity data model class .but the time of Updating by adding a new table the ado.net entity data model automatically removed all attributes which i given. Is there any way to update newly added table model class without effecting...
c#,model,asp.net-mvc-5,viewbag
I think that using ViewBag is faster than model. My example is: In the action: public ActionResult MyAction() { ViewBag.Data = (from m in myDatabase.myTable select m).ToList(); } In the view: @foreach(var item in ViewBag.Data) { <tr> <td>@item.myColumn</td> </tr> } By using model: [Table("tbl_mytable")] public class MyTable() { public int...
c#,asp.net-mvc,razor,visual-studio-2013,asp.net-mvc-5
When I'm trying to get values in Post the values of checkboxes are set to NULL when I don't check then in order (1, 2, 3, etc). I need to select any of them in no order (i.e. 4, 5). MODEL: public class AssignUsersViewModel { [Display(Name = "Check to select")]...
c#,asp.net-mvc,asp.net-mvc-5
Hi I've got the following code in my controller (asp.net 4.5.1 mvc 5) that allows a user to register on my site. Everything was working fine but Ive added another controller and another service and now when ever I try to register all it does on submit is redirect back...
c#,asp.net-mvc,asp.net-mvc-5,less,dotless
I have read this tutorial for working with Less in Asp.Net MVC5. To integrate LESS in ASP.NET MVC, I download and install the dotless NuGet package. And then added this bundle: var lessBundle = new Bundle("~/Less").Include("~/Content/Less/*.less"); lessBundle.Transforms.Add(new LessTransform()); lessBundle.Transforms.Add(new CssMinify()); bundles.Add(lessBundle); Here is the LessTransform: public class LessTransform : IBundleTransform...
javascript,asp.net,asp.net-mvc,asp.net-mvc-5,asp.net-routing
I have this MVC MapRoute routes.MapRoute( name: "Authenticated", url: "{controller}/{action}/{foo}/{bar}", defaults: new { controller = "Home", action = "WelcomePage", Foo = "0", Bar = "0" } ); And URL http://localhost/mysite/controller/action/2/1 How can I with JavaScript recieve the 2 and 1? I would prefer a solution with as little substring work...
asp.net,asp.net-mvc,asp.net-mvc-5,asp.net-identity,owin
I'm working on an MVC application that will feature a "plugin" architecture. Basically there will be a main "host" project that will dynamically load other projects at runtime. We want to move all ASP.NET Identity related stuff into its own separate plugin project. The main host project already contains an...
asp.net-mvc,asp.net-mvc-5,poco,html.dropdownlistfor,asp.net-mvc-scaffolding
I want to view, edit and create with drop-down list of my lookup relationships. Sometimes this works, sometimes it doesn't. It's a mystery that I'm hoping can be definitely solved here. Here's my POCO's for the lookup public class Color { public int Id { get; set; } public string...
asp.net-mvc,razor,asp.net-mvc-5,tag-helpers
I may use <a href='/Area/Controller/action'> </a> in asp.net vnext but just want to know whether we can use tag helpers like <a asp-controller="ControllerName" asp-action="ActionName" asp-area="AreaName"> to redirect to the specific file in the area. Will any one guide me how to redirect to a file in area using tag helpers.?...
c#,asp.net-mvc-5
My controller name is "demo". I write 2 actions with the same name "Index". The first uses [HttpGet] and the seconds is [HttpPost]. But, when I require a PostBack from View, the value of ViewBag.Name in the action [HttpGet] public ActionResult Index() {} can't be cleared. [HttpGet] public ActionResult Index()...
asp.net-mvc-5,sitecore8
I am working on a Sitecore/MVC application, my first MVC application so I am learning as I go. No doubt I am going wrong somewhere along the line. I have a Basket that has 2 address views on it, one for billing and another for delivery. There is also a...
c#,asp.net-mvc-5
I'm trying to figure out / where to start in regards to this situation say for example I enter $127.45 in to a textbox I would expect the application to spit back one hundred and twenty-seven dollars and forty-five cents The word will then be placed on a document and...
asp.net-mvc-5,export-to-excel
I have one MVC application, in which export to excel functionality is given. I want to redirect Index action once export is finished. I have written below code but it not redirected to index action. what i missed here ? output = new MemoryStream(); workbook.Write(output); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}",...
ajax,asp.net-mvc,asp.net-mvc-5,asp.net-ajax
I am not able to detect why my ajax call do not work. I am trying to read the contents of text file but it do not work, The problem is control never go to .done(function(data)) function makeCustomerTree() { // debugger alert('customertree'); $.ajax( { url:"~/bootstrap/js/LiveMap/Ajax/JsonStringCarryingData/customer-tree-json.txt", data: {}, type: "GET" }).done(function...
asp.net-mvc-5,mvc-editor-templates,editortemplates
At the moment, I have a working prototype for a questionnaire with multiple questions and each question having multiple choices for an answer. Everything displays and saves great. However, I now would like to group the question/answers into 'sections' on my Edit view. I have tried a couple different methods...
asp.net-mvc-5,foolproof-validation
I am trying to use MVC Foolproof library to validate my model and show error message respectively. However I am not applying the Data Annotation correctly so the validation does not works. My requirement is that I have two checkboxes and atleast one of them needs to be checked before...
asp.net,asp.net-mvc-5
So, I've copied a few methods from one controller to another, moved the respective views into the correct view folder and tried to debug my project.. After trying to navigate to one of the newly copied methods and views I get hit with this lovely error. Server Error in '/'...
c#,asp.net,active-directory,asp.net-mvc-5,active-directory-group
How would I get users from an AD Group which contains users from different domains. For example, I have 2 domains in my active directory, Domain1.corp.com and Domain2.corp.com I have an AD group called TestGroup which contains users from both the domains. Domain1 users: TestUser1, TestUser2 Domain2 users: TestUser3, TestUser4,...
c#,asp.net-mvc-5,epplus
I have an MVC view that correctly displays a model. Now that I have been asked to put an Export to Excel function on that page, I heard about EPPlus and gave it a try. From this site I thought I had something that would simply do the job. After...
c#,linq,asp.net-mvc-5,linq-query-syntax
I have a query as below: bool variable = false//or true var query = from e in _repository.GetAll<Entity>() from u in e.Users where (e.AuditQuestionGroupId != null ? e.AuditQuestionGroupId : 0) == this.LoggedInEntity.AuditQuestionGroupId from p in e.PractitionerProfiles.DefaultIfEmpty() select new { entity = e, user = u, profile = p }; This...
asp.net-mvc,asp.net-mvc-5,model-binding
One of my classes has some properties that I want model binder to always ignore them. Currently I'm using [Bind(Exclude ="")] in the action methods, like this: public ActionResult Edit([Bind(Exclude = "prop1, prop2, prop3")] BusinessModel model) This class has been used in several action methods. Do I have to manually...
c#,.net,asp.net-mvc,asp.net-mvc-5
I have a web application which runs on Azure which is currently running MVC3/C#, EF6.1, .NET4.5. I would like to upgrade it to MVC5 to be: a) Current b) Get benefit of new features c) Get Performance gains. This is a part of a performance project, so hopefully there will...
sql-server,asp.net-mvc,visual-studio-2013,asp.net-mvc-5
I am attempting a simple MVC 5 web application. I had it on LocalDB and it was find. Now I want to use SQL Server Express. Just would like to ask: Does the sequence has to be: 1, Designing your models, 2, Connecting to SQL Server from my Visual Studio...
asp.net-mvc-5
my scenario: I am finally getting around to creating my own blog, and I am trying to learn as much as possible with regards to MVC while doing so. I am trying to display my tags as a custom declarative helper in my "PostView.cshtml" file but my problem is that...
asp.net-mvc-4,asp.net-mvc-5,asp.net-identity,simplemembership
Migrating from MVC4 to MVC5 and want to use ASP.NET Identity too but I am struggling to find anything that covers everything I think I need to do to migrate the Identity. This link suggests all I need to do is create an ApplicationUser and migrate the data, and other...
asp.net-mvc,asp.net-mvc-4,razor,asp.net-mvc-5,claims-based-identity
I'm trying to learn Claims for MVC 5 OWIN login. I try'ed to keep it as simple as possible. I started with the MVC template and inserted my claims code (see below). I get an error when I use the @Html.AntiForgeryToken() helper in the View. Error: A claim of type...
c#,linq,asp.net-mvc-5
I have 'Property' objects with 'BayOption' child objects. I need the site search to search through the child BayOptions as well as the Properties and return Properties if the search criteria matches the child or parent. A Property can have multiple BayOptions (and usually does). I was unsure if .Select...
.net,asp.net-mvc-5
I have this controller public ActionResult Create() { var db = new MyDbContext(); IEnumerable<SelectListItem> items = db.FileUploadCategories .Select(c => new SelectListItem { Value = c.ParentCategoryID.ToString(), Text = "--" + c.CategoryName }); ViewBag.Categories = items; return View(); } And a view like this @Html.DropDownList("ParentCategoryID", (IEnumerable<SelectListItem>)ViewBag.Categories, "-- Select --", new { @class...
c#,asp.net-mvc-5
Why does Mvc remove + from code=wamTEpI6kZcP997j2d+ZeQ== link http://localhost:33693/PasswordRecovery/[email protected]&code=wamTEpI6kZcP997j2d+ZeQ== Controller Func public ActionResult InitPassword(string email, string code) { return View(); } ...
asp.net-web-api,asp.net-mvc-5,asp.net-mvc-routing,web-api,asp.net-web-api-routing
I have an Api controller with two different actions that take different parameter types. // GET: users/sample%40email.com [Route("users/{emailAddress}")] public IHttpActionResult GetUser(string emailAddress) // GET: users/1D8F6B90-9BD9-4CDD-BABB-372242AD9960 [Route("users/{reference}")] public IHttpActionResult GetUserByReference(Guid reference) Problem is multiple actions are found matching when I make a request to either. Looking at other answers I thought...
asp.net-mvc-5,ef-code-first,entity-framework-6
I'm porting a data model from EF4 to EF6 Code First. I'm getting the following message when the database creation is attempted. I'm at a loss to understand what is causing this. I don't have any Context, AstNode or JSParser entities. It is also not looking in the Models namespace:...
.net,asp.net-mvc-5
I have followed this tutorial to generate a dynamic list menu http://dotnetawesome.blogspot.se/2014/06/how-to-create-treeview-with-database-data-mvc4-aspnet.html This is the view @model List<Project.Models.Treeview> @{ ViewBag.Title = "Simple"; } <h2>Simple Treeview from Database Data</h2> <div style="border:solid 1px black; padding:10px; background-color:#FAFAFA"> <div class="treeview"> @if (Model != null && Model.Count() > 0) { <ul> @Treeview.GetTreeView(Model,...
asp.net-mvc-5,entity-framework-6,asp.net-identity-2
I am an Asp.net developer but very much new to the Asp.net Identity framework. I have been studying the sample application and followed some tutorials too on Identity but still I am not able to grasp the concept completely. I have very firm grip over Asp.net membership but Identity seems...
c#,asp.net-mvc-5,antiforgerytoken
I am taking the concept of building a OWIN login from a empty MVC and I am just starting to add the part with using my database to login the user after creating a Identity claim to put in the URL. This is my code to create the claim to...
c#,asp.net-mvc-5
I am completely stuck and confused why it works with one View to Controller but not the other one. The one that works: public class HomeController : Controller { // GET: Home IAuthenticationManager Authentication { get { return HttpContext.GetOwinContext().Authentication; } } public ActionResult Index() { return View(); } [POST("login")] [ValidateAntiForgeryToken]...
c#,authentication,asp.net-web-api,asp.net-mvc-5
So I have a C# MVC app using Identity for its authentication. I now have a need to expose a few things via Web API to some of my clients. Instead of building a separate app, project, deployment... I've simply added an API Controller to my existing project. To keep...
asp.net-mvc,validation,asp.net-mvc-5
In a MVC 5 application, I have a partial view with a button to submit some information. But when I push that button the parent form is validated, making all the validating errors displayed. All I want is that only the validated fields in the partial view are executed with...
c#,asp.net-web-api,asp.net-mvc-5
How can I make IsAuthorized return my custom object while function returns false? In my WebAPI project I have a class like; public class CustomAuthorizeAttribute : AuthorizeAttribute { protected override bool IsAuthorized(System.Web.Http.Controllers.HttpActionContext actionContext) { StandardWebAPIResponse invalidUserResponse = new StandardWebAPIResponse() { code = (int) Constants.ErrorCodes.InvalidCredentials, data = "InvalidCredentials.", StatusCode = HttpStatusCode.Unauthorized...
asp.net,angularjs,asp.net-mvc-5,angularjs-ng-repeat,angular-ui-router
How to do url(string) cocatenation in angular routing. Please refer the below snippet to understand my question. app.config(['$routeProvider', '$location'], function($routeProvider) { when('/', { templateUrl: '/AlbumsList.html', controller: 'a1Ctrl' }). when('/albums/:albumName', { templateUrl: 'AlbumsList.html', controller: 'b1Ctrl' }) }) app.controller('a1Ctrl', function($scope, $http) { $scope.albums = function() { //ajax getting data from server }...
asp.net,azure,visual-studio-2013,asp.net-mvc-5,sql-azure
I have a MVC 5 project using visual studio 2013. How can I add/create a database in azure from visual studio so that EF6 code first can just use and create the models? I've been browsing server explorer but there is nothing there related to azure....
javascript,asp.net-mvc,angularjs,razor,asp.net-mvc-5
Hey guys so I'm pretty new to AngularJS and I'm at a loss here. Right now my MVC program uses Razor to display all the data in my .mdf database (i.e: @Html.DisplayFor(modelItem => item.LastName) ). However, I want to go mostly Angular. I am trying to use ng-repeat to display...
javascript,c#,jquery,asp.net-mvc,asp.net-mvc-5
I have a form on a bootstrap modal with two buttons. This form is tied to an action named "DeleteWidgetConfirmed" I am trying to remove a widget from the database and from the front end, the panel gets removed from the front end but does not seem to get removed...
jquery,twitter-bootstrap-3,asp.net-mvc-5
I am using jquery to display bootstrap modal and want to add custom message at runtime. Here is what I am doing? but wondering if there is a way to merge two lines into one:- $("#modalBody").append("saved successfully"); $("#modal").modal("show"); Bootstrap Modal:- <div id="modal" class="modal fade" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <div...
sql-server,visual-studio,asp.net-mvc-5
My Website has two databases, one for user accounts and one for content. Both are created code first, and both have data in them. But I have only one mdf file in the project. The site works locally, the content gets displayed, I can edit and add to it, and...
asp.net,asp.net-mvc,asp.net-mvc-5,log4net
So I followed this tutorial to add logging to my project. Locally everything works fine, but when I deploy it to my staging environment and try to even visit the root page of the site I get a 403.14 Forbidden error saying that I need to enable Directory Browsing. I...
asp.net,asp.net-mvc,razor,asp.net-mvc-5
I have developed and deployed an MVC5 .NET app which runs within an intranet and uses LDAP to authenticate users. Since MVC 5 gives you the @Html.Antiforgery() by default I used them in every from. However in production where the app is running in multiple nodes I'm having problems with...
asp.net-mvc,exception-handling,asp.net-mvc-5
I have the following controller method public ActionResult Details() { try { Pacient pacientdp = new Pacient(); if (pacientdp.PacientPrenume == null) { return RedirectToAction("Index", "Home"); } var id = WebSecurity.GetUserId(User.Identity.Name); MedicalDBContext pacientContext = new MedicalDBContext(); Pacient pacient = pacientContext.Pacients.FirstOrDefault(x => x.PacientID == id); return View(pacient); } catch (Exception ex) {...
asp.net-mvc,asp.net-mvc-2,asp.net-mvc-5
I've got an old project from a friend that he wants me to do redo. How ever that project is written in ASP.net mvc2. So When I try to open it in visual studio 2013 I can errors. Saying the file is incompatible. How would I go ahead and fix...
c#,asp.net,asp.net-mvc,asp.net-mvc-5,razor-2
In my _Layout.cshtml: <section class="container content-section text-center"> @RenderBody() </section> I only want to have the "section" around when the "body" is not the home page. I was thinking of detecting url, but soon realized that I will have many Urls bound to the website, it's not the smart way to...
c#,asp.net-mvc-5,epplus
In my export ActionResult I was able to load the model into my ExcelPackage. Where I am having trouble is assigning a border around each cell once LoadFromCollection is applied. While the AutoFitColumns correctly applies, the border style I applied only works on Cells["D1"], but not on the table. BorderAround...
c#,asp.net,asp.net-mvc,entity-framework,asp.net-mvc-5
Ok so I have a relationship between the ApplicationUser and QuestionResults, my models are as below, the userId nor the UserName is retrieved, but I really need the UserId setup as a foreignKey on the QuestionResults entity. Any help is much appreciated the error that I am receiving is as...
c#,razor,asp.net-mvc-5,asp.net-identity-2
I am very new to identity and MVC, I am trying to create an MVC app as one of my first projects. I have been able to follow a few tutorials and have successfully added additional properties to my ApplicationUser : IdentityUser class public class ApplicationUser : IdentityUser<string, ApplicationUserLogin, ApplicationUserRole,...
asp.net-mvc,authentication,login,asp.net-mvc-5,owin
What if you have your own database and a BAL (Business Access Layer) and don't want to use DefaultConnection and the template ASPNET database tables but my own user tables? How can you use a custom database? ConnectionString: public class AppDbContext : IdentityDbContext<AppUser> { public AppDbContext() : base("DefaultConnection") { }...
c#,asp.net,asp.net-mvc,asp.net-mvc-3,asp.net-mvc-5
I have a view which displays a radiobutton list on left side of the page and it also loads a partialview on right side of the page which consist of various filters to be selected before displaying a report in a popup window. The problem is that the property named...
c#,.net,asp.net-mvc,asp.net-mvc-4,asp.net-mvc-5
Let's say such hidden field has genereated: <input data-val="true" data-val-number="The field MemberRelationId must be a number." id="MemberRelationId" name="MemberRelationId" type="hidden" value="3"> As you seem it has a value 3. It means that, user has already set the value for this field. But, he(she) can also change this value and I must...
c#,.net,entity-framework,asp.net-mvc-4,asp.net-mvc-5
I've added some properties to ApplicationUser, and two of them are ICollection's. When I use Update-Database it doesn't generate columns for these two members. So, what am I missing here? I imagine it's very basic. I'm used to working with Hibernate in Java, where it generates a new table for...
c#,twitter-bootstrap,asp.net-mvc-5,mvcsitemapprovider,mvcsitemap
I'm trying to build a menu like this: For reference I'm using this library https://github.com/behigh/bootstrap_dropdowns_enhancement @Html.MvcSiteMap().Menu("BootstrapMenuHelperModel") @model MenuHelperModel <nav class="navbar" role="navigation"> <div class="container-fluid menu-container"> <div class="collapse navbar-collapse"> <div class="navbar-header"> <span class="navbar-brand">FAR BACKOFFICE</span> </div> <ul class="nav nav-pills"> @foreach (var node in Model.Nodes) { if...
c#,linq,asp.net-mvc-5
I would like to convert the SQL syntax below to a linq statement to get a single boolean result back. The SQL is checking if a user exists in a current role. select case when exists (select 1 from Global.Application as a join Global.Role as r on a.ID = r.ApplicationId...
asp.net-mvc,controller,asp.net-mvc-5,views
I have a list of Checkboxes in a bool array, I wish I could give the Checked value as a "true" in that specific checkbox if it's checked by user This is my model using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; namespace testnumbers.Models { public class StringNumber...
c#,asp.net-mvc-5,entity-framework-6
I have a .Net 4.5 MVC 5 database first project that I'm playing around with. There's a data access layer (Entity Framework 6), a business logic layer and the MVC layer. If I have an object with relationships in the data layer: namespace DataAccess { public class Course { public...
c#,asp.net,asp.net-mvc,asp.net-mvc-5,partial-views
I am writing a recipe manager for my wife in C#/.NET MVC 5. I'm getting to the page for creating a recipe, and I'm a little stumped. A recipe consists of a Name and a list of ingredients. When I create a view, I have my form: @using(Html.BeginForm()){ //Form elements...
c#,asp.net-mvc,razor,asp.net-mvc-5,grid.mvc
I'm working on an MVC5 application. On the home screen is a grid allowing users to view Data and be transferred to a number of Views for various actions on each record. One of these is an [EDIT]. The issue I'm encountering is as follows: due to the amount of...
asp.net-mvc,oracle,linq,entity-framework,asp.net-mvc-5
I have an MVC5 View where I am using the Grid.MVC component (https://gridmvc.codeplex.com/). This allows me to easily display data from my Oracle DB and has out of the box functionality for Sorting/Filtering each Data Column. What I am trying to implement now is a Wildcard Search across all fields...
jquery,asp.net-mvc,asp.net-web-api,asp.net-mvc-5,put
I am having trouble finding the put action of a web api 2 controller. I'm using MVC5. The GET action in the controller is found and is working well when called. I have tried several different ways of hitting this, but to no avail. I would appreciate any hints. The...
c#,unit-testing,asp.net-mvc-5
In my controller, I have something like this: class HomeController { [AllowAnonymous] public ActionResult Index() { HomeViewModel viewModel = new HomeViewModel(); viewModel.FieldSearchCriteria = new SearchCriteria(); viewModel.Blogs = this.unitOfWork.BlogRepository.GetAllPublishedBlogs(1, 2, "PublishDate", SortDirection.DESC, null).ToList(); viewModel.FieldWanteds = this.unitOfWork.FieldWantedRepository.GetAllFieldWanteds( 1, 2, "CreatedAt", SortDirection.DESC, null ).ToList(); viewModel.Fields =...
javascript,asp.net,asp.net-mvc,asp.net-mvc-5,asp.net-mvc-routing
I have this ActionLink. @Html.ActionLink("Link", "action", "controller", null, htmlAttributes: new {@class = "menuLink"}) I have to set routeValues to null because I don't know the value at compiletime. They are recieved from the selectedvalue of some dropdowns at runtime. Hence, I am trying to augment the routevalues at runtime with...
javascript,jquery,asp.net-mvc,validation,asp.net-mvc-5
I want to populate a city/state drop down list based on the postal code a user types into a textbox. So when the text changes, I'm going to make an ajax call to retrieve the data. However, I only want to perform that ajax request for valid postal codes. The...
c#,json,serialization,asp.net-mvc-5,json.net
Update 1: for reasons I won't go into, I want to avoid having anything other than the properties to be persisted in my entity objects. This means no extra properties or methods... I have an entity called Entity1 with (say) 10 public properties. In one place in my code I...
javascript,c#,jquery,asp.net-mvc,asp.net-mvc-5
This is my first MVC application, and this must be something simple but I've been trying to make this work for so many hours now.. What I want to do I want to display a table in a partial view and be able to delete items from the parent view....
asp.net-mvc,active-directory,asp.net-mvc-5
It was similar to the linked answer but I used the following syntax instead: Ended up using [Authorize(Roles = "DOMAIN\\Group")] in the controller which worked perfectly I have a web app, that I've completed now and the only things outstanding are to: Upload to a web server; Make it so...
c#,razor,asp.net-mvc-5
I want to use 2 models. The first is on Index.cshtml page, and the second is on _Layout.cshtml page In the controller which contains the action public ActionResult Index(){...}, I declare some values and return it to View(). Like this: public ActionResult Index() { HomePageViewModel model = new HomePageViewModel(); //...
asp.net-mvc,asp.net-mvc-5,asp.net-mvc-routing
I'm building an intranet where I have the following home controller: [Route("{action=index}")] public class HomeController : Controller { public ActionResult Index() { return View(HomeModelBuilder.BuildHomeModel()); } public ActionResult FormsHome() { return View(HomeModelBuilder.BuildFormsHomeModel()); } } I'm trying to get my forms homepage to have a url of http://intranet/forms so I thought I...
ajax,json,controller,asp.net-mvc-5,actionlink
Click ActionLink on view, controller checks condition, returns JSON, JQuery Ajax doesn't work. Click the "Delete" ActionLink, "Delete" controller if customer's "Orders" property is null, if not null, a message will be popped up. If null, process to "Delete" view. Here are the codes: 1, on the view, the @Html...
asp.net,asp.net-mvc,asp.net-mvc-5,asp.net-mvc-6,asp.net-mvc-5.2
I need to get any ideas of how i should be managing our previous asp.net MVC 5.2 web application.. now i am using asp.net mvc-5.2 with entity framework 6.0. and i want to start phase-2 for some of these projects. so should i consider upgrading my mvc 5.2 to be...
c#,asp.net,asp.net-mvc,drop-down-menu,asp.net-mvc-5
I want to make a DropDownList with a numeric rating from 1-5. I have a rating model and I want to apply these dropdown values to WaitTime, Attentive and Outcome. Can I just set these values in the view and use the model? If so how would i go about...
c#,asp.net-mvc-5
I have a controller that I only want authenticated users to be able to access. Do I have to put a check in each method in my controller to verify a user is authenticated, or is there another way to handle this? Can I use annotations to do this instead?...
c#,asp.net-mvc-5,devexpress
While display bank transaction data to INR currency symbol (Rs.), output is not coming correct way. I need to display currency symbol along with 2 decimal points with thousand separator. I have tried so far1: column.PropertiesEdit.DisplayFormatString = string.Format("{0} #,0.00", Model.CurrencySymbol); I have used DevExpress MVC GridView. Current output when INR...
javascript,c#,asp.net-mvc,asp.net-mvc-5
I currently have panels and each panel has an ID associated with it which is held in the data-id attribute of each panel. I can get this easily through JavaScript. One the panels I have a delete button which will delete the panel and it's entry within the database. Once...
javascript,knockout.js,asp.net-mvc-5
Currently I have the following code, MVC with knockout bindings (this works fine) @Html.DropDownListFor(m => m.profiles, (SelectList)Model.profileItems, new { id = "ID", data_bind = "options: Profiles_msl, optionsText: 'profiles', optionsValue: 'ID'" }) I also have this which is kendo UI with MVC model bindings (no knockout). This also works. @(Html.Kendo().MultiSelect() .Name("Profiles")...
c#,asp.net-mvc,razor,asp.net-mvc-5
I have two methods: public ActionResult Index() { var propList = db.Properties .Where(x => x.SiteVisibilityFlags.HasFlag(Enums.SiteVisibilityFlags.Corporate) || (x.SiteVisibilityFlagsOverride == true && x.SiteVisibilityFlagsOverrideValue.HasFlag(Enums.SiteVisibilityFlags.Corporate))) // just ones visible to 'Corporate' .ToList(); // Use view model var pDVMs = DomainModelsToViewModels(propList); return View(pDVMs); } public ActionResult Region(string id) // (regionId/marketId) { // make sure to...
javascript,c#,asp.net-mvc-5
i get this in chrome debug picsList.push(BL.datafuncs+pics); a string insted of picsList.push([{img:"",url:""}]); an object <script> var picsList = []; @foreach (var item in BL.datafuncs.GetMainPagePics()) { @:picsList.push(@item); } </script> public class pics { public string img { get; set; } public string url { get; set; } } public static List<pics>...
ajax,asp.net-mvc,asp.net-mvc-5
I'm trying to send an ASP.NET AJAX request to my application. In the application's controller, I have: [HttpPost] [ValidateAntiForgeryToken] public async Task<ActionResult> Edit([Bind(Include = "ID,Name,Instructions,Glass,Notes")] Drink drink, [Bind(Include= "ID,Amount,Brand,IngredientID,DrinkID")] IEnumerable<DrinkIngredient> DrinkIngredients) { if (ModelState.IsValid) { //and so on my javascript looks like this: console.log($('#editDrinkForm').serialize()) var x = new XMLHttpRequest(); x...
asp.net-mvc,asp.net-mvc-4,asp.net-web-api,asp.net-mvc-5,asp.net-web-api2
I am working on .net web api in Asp.net Mvc5 project... By default it returns xml or json...in my project json/xml data returning fine... I am looking for the setting so that i can get response in JSONP.... Web Api config : public static void Register(HttpConfiguration config) { // Web...
razor,asp.net-mvc-5
I have a view, here's a fragment of it: @foreach (var item in Model.Items.ToList()) { <tr> <td> <input type="checkbox" name="productIdCheckbox" value="@item.sLabel"> </td> <td> @Html.DisplayFor(modelItem => item.sLabel) </td> <td> @Html.DisplayFor(modelItem => item.Text) </td> <td> @Html.DisplayFor(modelItem => item.OEMCode) </td> <td> <input type="number" name="qty" id="qty" min="1" max="1000" step="1" value="@item.Quantity" /> </td> <td> <input...
asp.net-mvc-5,mvcsitemapprovider
I'm using MvcSiteMapProvider 4.6.18. Many of my menu items link to external sites; however, the "url" attribute of mvcSiteMapNode is not being carried over to the menu. That is, I can see the url in the source, but the link is referring to the parent mvcSiteMapNode controller and action and...
c#,routing,asp.net-mvc-5
I am trying to prepare a 301 redirect for a typo I made 'recieved' I am struggling to find a way of getting the url from the action and controller names. I am aware of UrlHelper.Action but it does not exist within Global.asax. How do I gain access to this...
css,asp.net,asp.net-mvc,twitter-bootstrap,asp.net-mvc-5
I really don't know what I'm doing wrong. I want my textboxes with same size of my buttons below. I already tried change a lot in the cshtml but without success. Below my cshtml file: @model SomeModel.Models.LoginViewModel <div class="row"> <div class="col-md-8 col-sm-12 col-xs-12"> <section id="loginForm"> @using (Html.BeginForm("Login", "Account", new {...
asp.net-mvc,razor,asp.net-mvc-5
I have an MVC Razor page where I am trying to add a querystring parameter to the URL. <td> @Html.ActionLink(item.Student_Name, "Index", "FourCourseAuditDetails", new { filterByStudent = item.Student_Name}) </td> My desired outcome is: http://[server]/FourCourseAuditDetails/Index?filterByStudent="[item.Student_Name]", but when I test out the page, the anchor href attirubte looks like this: http://[server]/[route of current...
knockout.js,asp.net-mvc-5
I am trying to display all the employees in the database and I am unable to achieve it. My JS, var EmployeeKoViewModel = function () { var self = this; self.EmpId = ko.observable(""); self.Name = ko.observable(""); self.City = ko.observable(""); self.Employees = ko.observableArray([]); GetEmployees(); function GetEmployees() { $.ajax({ type: "GET", url:...
c#,asp.net-mvc,asp.net-mvc-5
A run time error occurs when i run my code asking me to do a code migration to update my database. I am not sure how to do this, can anyone help me? The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First...
c#,linq,asp.net-mvc-5
Error: {"'object' does not contain a definition for 'Id'."} ViewModel public class PilotoVM { private FormulaEntities1 db = new FormulaEntities1(); public IQueryable<object> calcularValoracion() { return db.Piloto.GroupBy(p => p.id).Select(p => new { Id = p.Key, Valoracion = p.Sum( i=> i.agresividad + i.paciencia + i.reflejos + i.valentia + i.valentia)}); } } Controller...
asp.net-mvc-5,asp.net-identity
I'm trying to implement own DAL for asp.net Identity 2.0 with functionality that I need. I don't need Account Lockout functionality. But When I try to call var result = await SignInManager.PasswordSignInAsync(model.Login, model.Password, model.RememberMe, shouldLockout: false); I get System.NotSupportedException:Store does not implement IUserLockoutStore<TUser>. So why should I need to implement...
javascript,jquery,knockout.js,asp.net-mvc-5
I have a table which has four columns namely Code, Name, Quantity and Price. Out of these, I want to change the content/element of Quantity column dynamically. Normally, it should show the element with quantity displayed in it and when user click on element, I want to show the element...
jquery,asp.net-mvc,visual-studio-2013,asp.net-mvc-5
I want to be able to post a json string to a control action but it's always receive the string as null. If I create a view model for the controller method, it works, but that's not what I want since there will be too much view models to maintain....