FAQ Database Discussion Community


Attempt to create usable VoIP phone by Twilio in ASP.NET-MVC fails as Only XML is visible on the website instead of phone

asp.net-mvc,twilio,voip,asp.net-mvc-5.2
I was searching for a long time for VoIP technology in ASP.NET-MVC. The only thing I have found is Twilio. I created ASP.NET-MVC 5.2 app and added references to: Twilio.Api Twilio.Mvc Twilio.Twiml I reduced _Layout.csthml to the minimum: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> @Styles.Render("~/Content/css")...

MVC 5 seeding users only works for email

asp.net-mvc,asp.net-membership,asp.net-mvc-5.2
I am working on a porject built on MVC5 and EF Code First. I have multiple contexts, but the one I'm concered about here is the ApplicationDbContext which has the following configuration code: namespace DX.DAL.Migrations.ApplicationDbMigrations { public class Configuration : DbMigrationsConfiguration<ApplicationDbContext> { public Configuration() { AutomaticMigrationsEnabled = false; MigrationsDirectory =...

MVC 5 Using POSTAL with Models

model-view-controller,asp.net-mvc-5.2,postal
I am trying to use Postal in Mvc.5.2.3 and Razor.3.2.3 in Visual studio Ultimate 2013, I have many forms to generate for this project and would like to use Views as i would like to Post content to a database as well as send an email out with the information...

Linq to DataSet

c#,linq,linq-to-sql,jointable,asp.net-mvc-5.2
I want to pick up all Sellers that aren't boss of a department. How can I make this? In this query below, only the Sellers that are bosses of a department are picked up, I want the opposite of thereof. My query: var query = db.Sellers .Join(db.Departments, s => s.Id,...

About Enum and DataAnnotation

c#,enums,data-annotations,asp.net-mvc-5.2,displayattribute
I have this Enum (Notebook.cs): public enum Notebook : byte { [Display(Name = "Notebook HP")] NotebookHP, [Display(Name = "Notebook Dell")] NotebookDell } Also this property in my class (TIDepartment.cs): public Notebook Notebook { get; set; } It's working perfectly, I just have one "problem": I created an EnumDDLFor and it's...

Autofac: How do you register a generic with multiple type arguments? Registering IGenRepo with EFGenRepo

c#,entity-framework-6,autofac,asp.net-mvc-5.2,.net-4.5.2
I am trying to build a generic repo and use autofac for testing. I have the following interface: public interface IGenRepo<T, TKey> where T : class { IQueryable<T> Items { get; } T find(TKey pk); RepoResult delete(TKey pk); RepoResult create(T item); RepoResult update(T item); RepoResult save(); } And here is...

MVC5 - using clockpicker to populate model

jquery-ui,bootstrap,asp.net-mvc-5.2
Firstly I am self teaching myself MVC so none of this may be best practice and the question may be considered MVC 101. I have googled and tried various things for days so in frustration I am looking for help. I am using MVC5, EF6, and Bootstrap 3 My objective...

Google map API in MVC5 ASP.NET

c#,asp.net-mvc,google-maps-api-3,asp.net-mvc-5,asp.net-mvc-5.2
Good day everyone. I can't figure out how to make this google map API v3 in a MVC asp.net page. This is the page code $(document).ready(function () { var gmarkers = []; var map; function initialize() { var mapProp = { center: new google.maps.LatLng(20.593684, 78.96288), //India Lat and Lon zoom:...

JSON with MVC is not working

ajax,json,asp.net-mvc-5.2
<div id="updatePanel"> </div> My JS script: <script type="text/javascript"> $("#MyDropDownID").change(function () { $.ajax({ url: "@Url.Action("MyMethodToGetList","MyController")", contentType: "application/json; charset=utf-8", type: 'GET', dataType: 'json', success: function (data) { loadData(data); }, error: function (xhr, status, error) { alert(error); } }); }); function loadData(data) { var tab = $('<table class="myTable"></table>'); var thead = $('<thead></thead>');...

HttpPostedFileBase Editor Template in ASP.NET MVC

c#,asp.net-mvc,mvc-editor-templates,asp.net-mvc-5.2
I am working with ASP.NET MVC 5 and have this simple ViewModel. public class ArtistVM { public string FName { get; set; } public string LName { get; set; } public HttpPostedFileBase ImgUpload { get; set; } } I know that I require a custom editor template for HttpPostedFileBase, so...

Make a required field if the other field has value

javascript,c#,jquery,controller,asp.net-mvc-5.2
I have these variables: public int? BossId { get; set; } public DateTime? HeadShipDate { get; set; } My view: <div class="form-group"> @Html.LabelFor(model => model.BossId, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownList("BossId", null, "-- Select --", htmlAttributes: new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.BossId,...

Populate DropDownList by JSON

javascript,asp.net,json,asp.net-mvc-5.2
-- Controller -- [WebMethod] public ActionResult GetSellers() { List<Seller> sellers = db.Sellers.ToList(); return Json(sellers, JsonRequestBehavior.AllowGet); } -- View -- @Html.DropDownListFor(x => x.SellerId, new SelectList(Enumerable.Empty<SelectListItem>())) -- Javascript -- <script type="text/javascript"> $('#DeptId').change(function () { // DeptId is my another DropDownList $.getJSON('/SaleRecords/GetSellers'), null, function (result) { // My path var ddl = $('#SellerId');...

ASP.NET Identity + Entity Framework + SQLite to share

sqlite,entity-framework-6,c#-5.0,asp.net-identity-2,asp.net-mvc-5.2
For our project needs, I created my own ASP.NET Identity 2.0 Provider with SQLite database, and Entity Framework used in MVC 5.2 application. It's methods are all async. All of the problems with the connection to SQLite DB are resolved (I saw many questions regarding this) So, my question is...

Providing a login form in default MVC header layout

c#,asp.net,asp.net-mvc,asp.net-mvc-5.2
I'd like to add a login form onto the default _Layout page of ASP.NET MVC 5. Now while I do know how to include a partial page into my layout, one thing I'm struggling with is the model. How can I add a model to my _Login view (residing in...

A property on entity as route value in ASP.NET MVC

c#,asp.net-mvc,asp.net-mvc-5.2
I am working on a new project in ASP.NET MVC 5. On many cool website, you often see routes like this: www.website.com/artist/vincent-van-gogh/wiki www.website.com/artist/vincent-van-gogh/paintings So imagine I have an Entity Artist that looks like this: namespace BB.DOMAIN.Entities { public class Artist { public int Id { get; set; } public string...

Selected option

c#,jquery,visual-studio-2013,asp.net-mvc-5.2
View @Html.DropDownList("DeptId", null, "-- Select --", htmlAttributes: new { @class = "form-control", @onchange = "changeDept(this)" }) Javascript function function changeDept(ddl) { var lastValue = $(ddl).data('lastValue'); var newValue = $(ddl).val var t = $(ddl + ' option:selected').text(); if (confirm("Are you sure you want to change from " + $(this).data('lastText') + "...

Get lastest record from section using mvc5

asp.net-mvc-4,asp.net-mvc-5,linq-to-entities,asp.net-mvc-5.2
I want to show in my home page: All section (all link category and one lastest news record in this section). Please help me to complete my code. Thank you so much. My DbContext class: public partial class xxDbContext : DbContext { public xxDbContext() : base("name=xxDbConnection") { } public virtual...

Future plans to consider for asp.net mvc 5.2 web application, with releasing asp.net mvc6 (vnext)

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...

Asp.net MVC POST Complex objects to controller

asp.net,model-view-controller,entity-framework-6.1,asp.net-mvc-5.2
I am working on an enterprise scale project where I have a self referencing table called categories as below. Also in my current model I am using following table associations to fetch data. ( using EF6). I have M-M mapping tables in DB for above M-M relationships. In my controller...

ReactJS.NET MVC tutorial doesn't work?

javascript,reactjs,asp.net-mvc-5.2,reactjs.net
I'm trying to setup a new project in Visual Studio that is going to be MVC 5 with a single page app written in ReactJS. So I followed the guide on the ReactJS website. I got to the very first part where you run the project, and I got a...

Can't embed jQuery to @Html.ActionLink()

javascript,jquery,html.actionlink,asp.net-mvc-5.2
I have a small problem with the @Html.ActionLink tag. I want to change the background when clicking on it. But it doesn't work. <ul> <li>@Html.ActionLink("View Profile", "Profile", "User", null, new { id = "profile" })</li> </ul> and the jQuery code: $("#profile").click(function () { document.getElementById("profile").style.background = "linear-gradient(#00ff66, #00ff99, #00ff66)"; }); But...

Range Attribute for Dates

c#,data-annotations,date-range,asp.net-mvc-5.2,displayattribute
I have this class overriding the RangeAttribute: public class RangeDateAttribute : RangeAttribute { public RangeDateAttribute() : base(typeof(DateTime), DateTime.Now.AddYears(-20).ToShortDateString(), DateTime.Today.ToShortDateString()) { } } DataAnnotation for my attribute: [RangeDate(ErrorMessage = "Value for {0} must be between {1} and {2}")] public DateTime anyDate { get; set; } I'm using the method [ToShortDateString()] in...

Invalid Username or password on Seeded User Account MVC5

entity-framework-6,code-first-migrations,asp.net-mvc-5.2
I am working in a new MVC5 application that I built specifically to test this. I have two db contexts. The configuration.cs for the ApplicationDbContext is as follows: using FB.DOMAIN.Authentication; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using System.Data.Entity.Migrations; namespace FB.DAL.Migrations.ApplicationDbContext { internal sealed class Configuration : DbMigrationsConfiguration<DataContexts.ApplicationDbContext> { public Configuration() { AutomaticMigrationsEnabled...

In the default ASP.Net MVC template, why does the user get re-signed in every time they change something?

c#,project-template,asp.net-mvc-5.2
So I'm using the default ASP.Net MVC template and sorting out things I don't need from the project. The user keeps getting logged in again if they change things like their password or phone number. For example, in the ManagerController.cs file I keep seeing things like // // POST: /Manage/ChangePassword...