Newest 'asp.net-mvc-5' Questions

Q&A for professional and enthusiast programmers

Not able to read excel sheet saved as xls using closedxml

I have the below code to save the data in excel sheet as .xls public ActionResult ExportToExcel() { DataTable tbl = CopyGenericToDataTable(res); tbl.TableName = "...

Worldpay integration in MVC5

I need to integrate world pay in MVC5.I am developing on windows operating system. Could somebody tell me of any library that I could use. An example code will also be helpful.

Automating Azure deploy

I have created a configurable mvc5 application, lets say a kind of template (web UI with sql server and entity framework) with configuration values in a database table Our Customers will fill in a ...

List&Label Webreporting: Export/Printing does not work on IIS Server

Hi and thank you in advance for any help, I am trying to post a JSON-Object to an ASP.Net MVC-Server via JQuery/Ajax. The Controller method is supposed to take the JSON input and use it as a ...

How to create dynamic routing with data in database in MVC 5

I am using MVC 5 to create a website and I have table Category with structures: id, name, slug, parent. User can create category by themselves Ex: product/fashion product/fashion/men product/...

How to override a route in MVC 5

I've two controller controllerOne is defined under an area AreaOne . I need to reroute one of the action defined in the controllerOne to the action defined in controllerTwo I tried attribute routing ...

MVC 5 C# uses ChilkatDotNet45, which requires VC++ dependencies - can they be deployed to GoDaddy site with app?

How can I deploy VC++ Redist Pack to a GoDaddy shared hosted site? My question is the exact same as this except I am using VS2015 and .Net Framework 4.5.2. with ChilKatDotNet45 (which has a ...

Set CreatedOn property as current date

I am following the below link to try and solve my issue.. StackOverflow Solution The issue i have is i cant populate a field in my web form with the current date. Im using SQL 2014 and have the a ...

Redirect http to https in asp.net mvc [duplicate]

I need to redirect from htttp://metroyapi.com.tr or/and "http://www.metroyapi.com.tr" to https://www.metroyapi.com.tr. I already tried the following methods but none of them worked. At Startup: app....

Using foolproof and requiredif to validate a string field

I have the following fields in my data model: public bool JointAccount { get; set; } [RequiredIf("JointAccount", "true", ErrorMessage = "Please select a Title")] public string JointAccountTitle { ...

Unable to employ AutoFac correctly in a repository setting using the ASP.NET MVC HTML5 Boilerplate

Current project: ASP.NET 4.6.2 MVC 5 Repository pattern from Persistence-Ignorant ASP.NET Identity ASP.NET MVC HTML5 Boilerplate I have done my best to follow the repository pattern in the article I ...

Kendo Grid Update Aggregate while filtering

I am using following code to bind Kendo Grid to datasource Everything working fine except filter with aggregate. Problem is, when I apply filtering to any column, footer aggregate sum of two columns ...

Render Action from area in layout page of mvc

I want to Render Index() action off my Area (named Menu) in Layout Page of my main MVC project by this code and got Error on this line of layout @{Html.RenderAction("Index", "Menu", new { area = ""...

How to display version number and auto increment it in ASP.Net MVC - 5 Application

I am working on ASP.Net MVC web application. So, I make changes in localhost and then run it and test it. Post which I check in my code. From the main server TEAMCITY builds the project and changes ...

Override RedirecToAction method

Is there a way to extend the RedirectToAction method on mvc 5 for accepts masterName parameter. I'm looking for something like this: RedirectToAction(actionName: "Index", controllerName: ...

Why AutoMapper won't initialize without its static void method

I only show you the part of AutoMapper that won't work. I got this: var config = new MapperConfiguration(cfg => { MappingModelsToViewModels(cfg);...

asp.net mvc area not working on iis

I crated area/modular MVC5 application according to this tutorial: This it worked perfectly on local. but i got 404 error, when i deployed project on iis and clicked on specified area link. and i ...

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key “Geslacht”

First of all, I'm a beginner in what concerns C#, Razor, ASP.NET... I want to make a 'DropDownListFor' for the genders with a 'List' but the problem is that I get the errormessage as described in the ...

How to convert SQL CONCAT Query from SQL Server to LINQ Query? [on hold]

SELECT CONCAT('[', LAND_ID, ',', '''', CASE WHEN DEVELOPMENT IS NULL OR DEVELOPMENT = '' THEN LOCATION ELSE DEVELOPMENT END , '''', '...

Change default @html.DisplayNameFor

guys. I've been thinking. I'm making a table based on a database column. So, by default, asp.net gave (for example) : @html.DisplayNameFor(model => model.FULL_NAME); But then it would displayed ...

Is there an HTTP status code for (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)?

if there isn't, I need to know how to capture that error in my applicaion and display a suitable message to the user. I am using mvc5

Jquery validation not working for strong password in mvc5

Hi I am developing one application in mvc5 with jquery. I am trying to implement regular expression for password as below. This is the piece of code from jquery.validationEngine-en.js "...

Pass array of objects to MVC Controller Action via JQuery AJAX, Action Parameter is always null

I am having following controller action in ASP.NET MVC [HttpPost] public JsonResult Save(List<Mixing> lstmixing) { int TMPMIXINGNO=0; foreach (Mixing mixing in lstmixing)...

How can I show the custom error page on remote access?

Context: We want to use a custom error page to show errors to the user. In the Global.asax file uses the Application_Error hook to forward all errors to the custom error page in our ErrorController. ...

How to call nested ajax call and send object data to controller in ASP.Net MVC 5

I have two controller Settings Controller Action - GetAvailableLocationsFor HomeController Action - Index Steps I want to acheive Make ajax call to GetAvailableLocationsFor and then get the ...

ASP.NET MVC 5 Form Validation and Error Handling

Trying to implement data validation and error handling on a simple contact form. When I add the check for ModelState.IsValid I'm in a chicken and egg situation. I have looked at other similar ...

How to check if MVC bundle exists

Is there a way to test if a bundle exists before trying to render it? I want to do something like this: @{ var bundleName = GetBundleName(); } @if (Scripts.BundleExists(bundleName)) { @...

Ajax function always returns false

I have have web-service that checks whether a userName exists in the database or not, the service is working fine I checked, the problem is when I'm trying to call it using ajax function the result is ...

How to pass custom model object from razor view to controller action in ASP.NET MVC 5

I'm writing my first production application in mvc 5. I'm trying to pass a custom object as a parameter to a http post action in my controller. Basically, I have a view wrapped in my CustomerReport ...

How to know the Web Site version in ASP.net MVC

I am a total beginner so pardon me If I do no ask question properly. So, I have one ASP.Net MVC - 5 project. So whenever I make any change I run it on localhost and then after testing I publish it to ...

How to call controller method and pass the object from ajax call in ASP.Net MVC

I am in a learning process and working on ASP.net MVC 5 project. So, I have a model view which has other model views in it. Parent Model View public class FullConfigMV { some properties here ...

how to use union for List<anonymousType> and List<Order> in linq

I have a Linq code as below: var checkList = (from dc in _debtorCreditorService.GetAllDebtorCreditors() join n in _notificationService.GetAllNotification() on dc....

How can I pass a hidden value using @Html.HiddenFor?

I think i have to change the question. I tried to put the value and it suceeded. But, it gave me an error Validation failed for one or more entities. See 'EntityValidationErrors' property for more ...

ASP.NET token error reset password

I just add the "forgot password" part of MVC 5 in my project and i can't change my password after receiving the email. The error:In the App => Image of error in the app In Visual Studio => Image of ...

ASP.NET MVC 5 application on Azure won't log exceptions

I'm having difficulties getting uncaught exceptions logged when deploying my ASP.NET MVC 5 application to an Azure App Service slot. When an uncaught exception occurs, the app rightly returns a 500 ...

Injecting a nullable dependency via constructor requires unity to register that nullable dependency

Just wondering if anyone had this scenario with Unity(as an IoC container) where the class has two injected dependencies(interfaces) where one dependency can be null. For example: public MyServiceDll(...

How to create a base class that accepts parameters for controllers without changing child controllers?

I'm trying to add ninject to the following setup - public class BaseController : Controller { protected ILogger Logger {get;} public BaseController() { Logger = new MyLogger(); } } public ...

Crystal reporting using VS 2015 and MVC5

I'm new in MVC5, i got this error when using Crystal reporting tool, An exception of type 'System.NotSupportedException' occurred in System.Data.dll but not handled in user code Additional ...

MVC 5 with SSRS

I just want to know what is the problem of this When I input this when inputting a record this is the output in the print preview When printing the record

Error: The input contains a non-base 64 character, more than two padding characters

I am using asp.net mvc built in template for authentication . For some customization Roles I copied the New Registration User code on another page and stored in database by following way . public ...

simple login form in mvc-5 asp.net

i just started mvc-5 and i am unable to find example in mvc-5 for the people who just started using with core(c#) i used mvc-5 but with angularjs so when i try to use with the core of c# i am not able ...

How to show user comments in hierarchical fashion in asp.net mvc

I'm beginner in asp.net mvc. I have a product model and I want implement user comments for any product. I want to show comments as tree for each level. I use a recursive method in my view to show ...

Issue with Routing while Adding MVC 5 to Webforms 4.6

we currently have a big Webforms application thats currently running on 4.6 framework. We have the webforms routing already setup. Now, we are trying to add MVC to this project and make it a hybrid ...

Asp.net - how does it handle references to database rows?

I have a web application I'm building where I have a worker thread that holds a reference to a database row. I have an outside service that is calling the web application, and depending on user ...

Ajax does not retrieves data in partial view in mvc 5 using SQL Server 2008 R2

Here is my HTML : @model ModalPopupMVC.Models.User @{ ViewBag.Title = "Index"; } <h2>Index</h2> <p> @Html.ActionLink("View All", "Index") @using (Html.BeginForm("...

How to prevent a node from appearing in breadcrumbs MVC

There are certain nodes in my solution that need to appear in menus/navigation but not appear in the breadcrumbs, as they do not link to actual pages and therefore just present an error when clicked. ...

MVC5 - How to set “selectedValue” in DropDownListFor Html helper

As the question says: How to set selectedValue in DropDownListFor Html helper? Tried most of the other solutions but none worked that's why I am opening a new question. Nothing of these helped: @...

MVC5 how do I render/create/change button colours using a method/condition from the controller?

I want to dynamically render a web page's button by using a condition. I was thinking along the lines of having something like this in the controller: public bool checkUser(){ if (User.Identity....

select multiple data from one table with date range and insert into another table c# sql

I am creating a web app with mvc-5 angularJS. I have two tables in my sql, in my first table I have multiple data's employee table date name job sonvinid 10-10-2013 ...

Int input type in MVC5

I have a textbox that allows only integers. I recently created a page in MVC 3 that has a similar textbox with this input type: @Html.TextBoxFor(model => model.sessionDurationMinutes,new {style="...
Translating... 0%