[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More







Microsoft’s ASP.NET MVC is a web application framework that implements the model–view–controller (MVC) pattern. As an open-source software, it’s set apart from the ASP.NET Web Forms component, which is proprietary.

Share tech news, updates, or what's on your mind.

Sign up to Post

I am using MVC 5 with entity framework verison 6 using a SQL database. The ID field is the primary key in the PL_System table and the foreign key in other tables. My problem is with the Create view of PL_System. Since ID is the primary key and is required, it has to have a value. It is set as an int.

The ID field in the create view is a dropdown. How do I get this to be an auto-generated field rather than a selectable list? I want this to be a new system which will take the ID that is next in the sequence of numbers. In this case, the last ID in the table is 55. I want the next system to have the ID 56 and so on...

[Disclaimer: This was an Access database imported into SQL]

PL_System Controller > Create
// GET: PL_System/Create
        public ActionResult Create()
            ViewBag.Availability = new SelectList(db.PL_Availability, "ID", "Score");
            ViewBag.Confidentiality = new SelectList(db.PL_Confidentiality, "ID", "Score");
            ViewBag.Integrity = new SelectList(db.PL_Integrity, "ID", "Score");
            ViewBag.Information_System_Owner = new SelectList(db.PL_SystemOwner, "ID", "Full_Name");
            ViewBag.Status = new SelectList(db.SSP_SystemStatus, "ID", "Title");
            return View();

        // POST: PL_System/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see 

Open in new window

Acronis True Image 2019 just released!
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

I have developed a website (https://inbranchcardprinting.azurewebsites.net) that my credit union will be using to upload a picture from a members phone to our Azure storage blob that will be printed onto their custom debit card. The main issue is right after the upload page (and before the thank you page just fine while exiting that action fine) Safari will display one of two error messages.
The first and most common one is "This web page has been reloaded because a problem has occurred." Sometimes this is accompanied by a dialog box asking to resubmit the form.
However, everything on the back end worked fine. No server side errors were thrown and the image is successfully uploaded to our azure storage. I step through the controller and everything works fine and exits the action with no issue. This problem does not occur on desktop or Android devices.

Now I know that I can reproduce the bug so I look into how to diagnose iOS safari pages and tried to use their Web Inspector tool. I get it loaded up on my Mac just fine and tethered my iPhone to the Safari session. I go to the page and not only does it error on my iOS device it crashes my Mac's Safari window of debugging. So next I try to use Xcode's Simulator and system logging to capture the issue, and nearly the same thing happens only I get an on screen(simulator) error of "This page can not be loaded because the web page stopped responding." This doesn't crash the Simulator, but the logger window did not record …
My MVC app works great locally, but when i publish into a virtual directory it calls the wrong path
I.e.  instead of  
it calls

Here is the piece of code in question

$.getJSON("/../Home/PlotProbeData", { probe: probeData }, function (data) {

Open in new window

i've looked online and it suggests using url.content or url.action, but what I tried doesn't seem to work

the above code exists inside the cshtml file.

one of my developers suggest to use this esign api for our company we are heatlh insurance broker in FL.

we all know docsign and they are just so expensive to us
and we don't compare this esign form with docsign.

just want to hear all experts what you think about this product from security, performance, and development sides
In web forms, I know how to create master page.  Is it possible to create a master page in ASP. Net core MVC? Please show an example and link.
I am using ASP.NET MVC 5 with entity framework version 6. I have the PagedList.MVC nuget package installed. I get the error listed below when attempting to sort in my Index view. I'm sure it is something really simple that I am overlooking.

The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.'

Controller Code listed below:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using ITRA.Models;
using PagedList;
using PagedList.Mvc;

namespace ITRA.Controllers
    public class SSP_ControlController : Controller
        private RiskAssessmentEntities2 db = new RiskAssessmentEntities2();

        // GET: SSP_Control
        public ViewResult Index(string sortOrder, string currentFilter, string searchString, int? page)
            ViewBag.CurrentSort = sortOrder;
            ViewBag.NISTIDSortParm = String.IsNullOrEmpty(sortOrder) ? "NISTID_asc" : "";
            ViewBag.TitleSortParm = String.IsNullOrEmpty(sortOrder) ? "Title_asc" : "";
            ViewBag.WorksheetStatementSortParm = String.IsNullOrEmpty(sortOrder) ? "WorksheetStatement_asc" : "";

            if (searchString != null)
                page = 1;
                searchString = currentFilter;

Open in new window

I have very rare website that allow owner and renter to get motorhome similar to turo but now I am looking for insurance companies that partner with us so we can get insurance for each rental

I hope to know what I can do to get start it.
I'm new to MVC, so struggling to understand if this is possible

I have a bit of code which I call in the homeController.cs
public ActionResult PlotGraph()

Open in new window

I would like to be able to call this on click of a UI item and pass in a different groupId.....i.e.
public ActionResult PlotGraph(string GroupId)

Open in new window

Then on first load of the page it would need to just load the default group, so i was trying to call it using this from cshtml page:

Open in new window

I've added the comma and zero, however it fails when it hits this line
Am i doing this totally wrong, or should this be possible, if so how do i make it work?

I want to search in four other dropdown lists and list it in another place. Mvc.Net
I wrote this code using ASP.NET webforms and would like to move it to an MVC solution.  What should go in the controller and what should go in the model.  How do I pass information from one to the other?

            string ErrorMessage="";

            //check name lengths are OK.
            if (txtBorrowerFullName.Text.Length == 0)
                ErrorMessage = "Borrower fullname empty. ";
            if (txtBorrowerFullName.Text.Length > 54)
                ErrorMessage = ErrorMessage + "Borrower fullname exceeds 90 characters. ";

            if (txtBorrowerName2.Text.Length == 0)
                ErrorMessage = "Borrower name empty. ";
            if (txtBorrowerName2.Text.Length >19)
                ErrorMessage = ErrorMessage + "Borrower name exceeds 19 characters. ";
            if (txtBorrowerShortName.Text.Length == 0)
                ErrorMessage = "Borrower shortname empty. ";
            if (ErrorMessage == string.Empty)
using (SqlConnection sqlCon = new SqlConnection())
                    using (SqlCommand sqlcmd = new SqlCommand())
                       ConnectionString = ConfigurationManager.ConnectionStrings["UK1SDI2DSConnectionString"].ConnectionString;
                        sqlcmd.Connection = sqlCon;
                        sqlCon.ConnectionString = 

Open in new window

Has Powershell sent you back into the Stone Age?
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

I am very new on using json and I want to have very simple code in c# to request docsign signature with json format.

can you show me ? thanks

I have most of the set up like api key and etc already

it works if I use four models but it doesn't work if I use 5 or more

For example;

My Problem İs mvc asp.net viewbag.title erorr

please help me
Is there a way in ASP.NET MVC (c#) to create html markup and save to database and then of course to be able to edit it in a html editor in a view.

Here is the issue.

This control below will only take in text at the moment but i need to add in formatted text. Do i need to add in an editor or is there anything within visual studio/c# mvc that will enable me to add formatted text. If not, please recommend the best html editor for this purpose. Thanks in advance.

    <div class="form-group">
                @Html.LabelFor(model => model.FullDescription, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @*@Html.TextAreaFor(model => model.FullDescription, new { htmlAttributes = new { @class = "form-control" } })*@
                    @Html.TextAreaFor(model => model.FullDescription, 10,40, htmlAttributes: new {style="width: 100%; max-width: 100%;" })
                    @Html.ValidationMessageFor(model => model.FullDescription, "", new { @class = "text-danger" })
I have the following method below and I'm having a hard time understanding what does the following notation mean... The following code is reading from a table and converting it to a variable just not sure why the 9?

requiredFields[9] == 'T',  why a 9?

public static GeneralSetupProgramJobParameter GetProgramJobParameters(
            GeneralSetupProgramJobParameter item,
            string reqdfields,
            string prodparam,
            string chngparam,
            string estutilfld,
            bool defaultStatus0For2ndPrgm
                var requiredFields = reqdfields.ToCharArray();
                var productionDefaults = prodparam.ToCharArray();
                var changeParams = chngparam.ToCharArray();
                var estUtilFields = estutilfld.ToCharArray();

                item.DefaultToStatus0For2ndProgram = defaultStatus0For2ndPrgm;

                item.ProgramJobRequiredFields = new ProgramJobRequiredFields
                    IsRequiredDateSold = requiredFields[9] == 'T',
                    IsRequiredSalesPerson = requiredFields[11] == 'T',
                    IsRequiredSource = requiredFields[10] == 'T',
                    IsRequiredSize = requiredFields[16] == 'T',
                    IsRequiredRoute = requiredFields[14] == 'T',
                    IsRequiredCancelDate = requiredFields[12] == 'T',
                    IsRequiredCancelReason = requiredFields[13] == 'T',

Open in new window

Hi Experts,
I am working on a MVC.Net application with C#.Net code-behind.

I am using an Array in one of my views.
I am able to populate my array just fine, but I need to do the following once I have populated my array:
1. Group by the following fields: order, item, description
2. Sort by the following fields: order, item, description

I have included my javascript code below.  
Please show me how to do my grouping and sorting of my javascript array.

var claimsHeader = new Array(); 

function onDataBoundHeader(arg) {
	var dataItemsHeader = arg.sender.dataSource.view();

        for (var j = 0; j < dataItemsHeader.length; j++) {
            var order = dataItemsHeader[j].get("Item");
            var item = dataItemsHeader[j].get("Market");
            var description = dataItemsHeader[j].get("Description");
            var claims = new Array(order, item, description);

Open in new window

Thank you in advance,
I need a help sample code to connect to ZenDesk API using basic authentication, User Email and Token written in C#. Please advise.
I have created a GeneralSetupCompanyView Model inside my GetViewModel but I'm getting the following error when I assign my property CountryOption to the value CountryOptions = GetViewModelCountryOptions(vm.SelectedCountry).  
This GeneralSetupCompanyView is in a different namespace than the namespace ServiceAssistant.Areas.Parameters.Controllers.

My question is do I need to move my Service.Assistant.Model.Service.Picker.Item to the namespace where my GeneralSetupCompanyreside  or how should I correct this line of code:
CountryOptions = GetViewModelCountryOptions(vm.SelectedCountry),

Cannot implicitly convert type "System.Collection.Generic.List<Service.Assistant.Model.Service.Picker.Item>'to 'System.Collections.Generic.List<Systems.Models.SelectPicker.Item>'

namespace ServiceAssistant.Areas.Parameters.Controllers
    public class CompanyGeneralSetupController : BaseController
        // GET: Parameters/CompanyGeneralSetup
        public ActionResult Index()
            var employee = LoggedInUser;
            canView = null;
            if (!canView)
                return RedirectToAction("Index", "Parameters", new { area = "Parameters" });

            var viewModel = GetViewModel(employee);
            return View(viewModel);

        private GeneralSetupCompanyViewModel GetViewModel(Employee employee)
            var parameters = 

Open in new window

Currently I have built an application (using Visual Studio .Net MVC Web Application in C#) which opens up specific views in Sage 300, which I then use to pull specific table information. I am currently trying to get Quantity on Hand data (the number) from Sage 300's IC0290 ROTO ID View. The code I have will only bring back "0". It does bring back other information from the same table as long as the values for that information are strings. The value type for QTYONHAND is BCD*10.4 . I am trying to use Decimal in C# but it brings back a 0. I have the code listed below. If anyone has any ideas on how I can get the actual data to come through, I would greatly appreciate it.

private void OpenSessionDBandView()
        // Create, initialize and open a session.
        session = new Session();
        session.Init("", "XY", "XY1000", "62A");
        session.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Today, 0);

        // Open a database link.
        mDBLinkOpen = session.OpenDBLink(DBLinkType.Company, DBLinkFlags.ReadWrite);

        // Open the I/C Items View - "IC0310"
        icItemView = mDBLinkOpen.OpenView("IC0310");

        // Open the I/C Items View (Quantities on Hand) - "IC0290"
        icLocationDetailsView = mDBLinkOpen.OpenView("IC0290");
    public string DoIt()
        string returnHTML;


        decimal itemQoH;
        // "itemNumber" is a value derived from a form created. User submits …
Powerful Yet Easy-to-Use Network Monitoring
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

I running into a pittfall I have an action that I'm trying to refactor so that it call a service that will populate a model that I created.

 My only issue is that I have a bunch of method that I'm not sure if they should belong to the service or I just should leave them on the controller level. My assumption is to not implement these method in my new service that I will create.  The methods that I'm referring to are as follow:
 PopulateSecurityParameters(parameters, viewModel);
  PopulateCancelSoldParameters(parameters, viewModel);
  PopulateCallLogParameters(parameters, viewModel);

[  private ViewModel GetViewModel(Employee employee)
            var viewModel = new ViewModel();
            var parameters = ParameterConfigurationService.GetParameters();

            viewModel.CommonSmtpSettingsOptions = GetCommonSmtpSettingsOptions();

            viewModel.StatusInfoList = GetStatusInfoList(parameters);

            PopulateSecurityParameters(parameters, viewModel);
            PopulateCancelSoldParameters(parameters, viewModel);
            PopulateCallLogParameters(parameters, viewModel);
            PopulateGeneralParameters(parameters, viewModel);
            PopulateAppointmentCallParameters(parameters, viewModel);

            viewModel.CountryOptions = GetViewModelCountryOptions(viewModel.SelectedCountry);
            viewModel.QuickNoteOptions = 

Open in new window

I would like to get some feedback on what is the best way to create a model from this screen representation that I have attached bellow. I created a class GeneralSetupCompanyParame and I'm not sure how I should declare each property that I have circled in yellow in my screenShot. The one for the English,Spanish, French Description...

I'm just looking for the best representation. I started creating my company class, I'm just missing how I will set my property for the English,Spanish and French Description.

 public class GeneralSetupCompanyParameters

         public class SMTPSettings
            public string CommonSMTPSettings { get; set; }
            public string SMTPServer { get; set; }
            public int SMTPPort { get; set; }
        public string CountryName { get; set; }

        public string ServiceYear { get; set; }
        public string QuickNote { get; set; }
        public bool AllowFutureSaleDates { get; set; }
        public bool ForcePWComplexity { get; set; }
        public bool AppointmentNotification { get; set; }
        public bool LimitPastSaleDates { get; set; }
        public int LimitPastSaleDatesDay { get; set; }
        public bool ForcePeriodicPWChanges { get; set; }
        public bool LockCallLogEntries { get; set; }
        public string EveryDay { get; set; }
        public bool LimitPastCancelDates { get; set; }
        public string LimitPasCancelDatesDays { get; set; }
        public bool 

Open in new window

Hi All,
Am following  this link to create we signature. It is working for one display and one editor. How to have 2 display and 2 editors respectively.

please find the screen shot. i need to capture WLM signature and editor image.

Kind regards,
I need some examples of how to do advanced grouping and formatting using GemBox and C#.
We use MVC

Thank You!
Hi Expert,
I'm start learning  ASP.net MVC ,But I understand there is ASP.net core MVC, Which one you guys think i have to study
For any new Product development which technology is best - Angular / MVC Core / React ?






Microsoft’s ASP.NET MVC is a web application framework that implements the model–view–controller (MVC) pattern. As an open-source software, it’s set apart from the ASP.NET Web Forms component, which is proprietary.

Top Experts In