Category "asp.net-mvc"

How to pass model as a Parameter in Repository method at controller?

So my problem is like that, When I am trying to pass the model in repository method on controller I getting error like this Object reference not set to an insta

Why images paths not store in database MVC5?

I'm new to MVC so I hope to get help regarding my question. I am making users upload images. the image path will store in the database but the image itself will

Asp.Net MVC - ViewModel vs Domain Model vs Entity Model [closed]

Have been through many artciles, but didn't get enough clarity on the usage of the 3 different models mentioned. As we know, View Model - is

Sorting a 1-to-many relationship for a log table for the most recent item

So I have a table, Equipments, that contains assets. There is a table connected to this one in a 1-many relationship that logs each time it is inventoried, by w

When using ASP.NET MVC, what is the best way to update multiple page sections with one HTML.Action() method?

I have a pretty big ASP.NET MVC site with 100 controllers and thousands of actions. Previously the header image that was defined on the Site.Master page was ha

Displaying an iframe with @Html.Raw is not working like when displaying Script with @Html.Raw

Note: This is written in asp.net mvc 5. That is the tech I am using for this. I am used to displaying certain data when I use @Html.Raw to show data from a Mode

'HttpClientFactory' does not exist in the current context

I'm writing an application in C#. It pulls the data from Cloudant NoSQL DB. But when I'm trying to create the Http client: HttpClient client = HttpClientFacto

How to effectively change authentication method in ASP. NET web.config?

I am trying to launch ASP.NET project on a local computer. IIS responds with 401.0 status code, stating that "authenticated user does not have access to a resou

Web.config causing "blocked by group policy" error

The myriad of different web.config settings have always been a bit of a mystery to me. I'm glad Microsoft has cleaned up some of the content put there by defaul

How do I post SQL data using submit button in asp.net c# razor

Thanks in advance. Can anyone please help me get this button working so I can display a row from the Northwind database 'only' when the button is clicked. I h

Returning BadRequest in method that returns PartialViewResult

I have an MVC5 application that has a method populates and returns a partial view. Since the method accepts an ID as a parameter, Id like to return an error if

How to Bind a group by data in view in mvc5? what are the best ways to do

I am using Entityframework context, i dont know how to bind to view. I am grouping items by gender public SQLChallengeEntities Sqlcontext = new SQLChallengeEn

How to set up a stub and assigning a webresponse with Rhino mocking

I'm completely new to Rhino Mocks and mocking in general. I'm still wrapping my head around how to code the mocks. I have a test class which contains something

"Select all" in Kendo MultiSelect (MVC)

I have a Kendo Grid with some custom editors, one is a multiselect. I have a cshtml file for the editor that looks like so: @model IEnumerable<ManageSitesInT

How to make script fire only once when a URL is accessed Google Conversion Tracking

I am using Google Ads to track purchase conversions on my Ecommerce website. When a user clicks on my Google Ad for a product and then makes the purchase and la

Scaffold-DbContext failed to build, how do i resolve this issue on Nuget console?

I have installed all required packages for this command, when i try to run this command on my console its failed to build. Kindly please assist to resolve this

Unable to resolve service for type Microsoft.EntityFrameworkCore.DbContextOptions

When I want to add controller using ASP.NET Core MVC with views: enter image description here This is my DbContext class: namespace Infrastructure { public

<label> element splits to multiple lines

I have a <label> element in my ASP.NET core MVC project, that splits to multiple lines instead of showing in a single line. I've inspected the element in

System.FormatException: Input string was not in a correct format. MVC5

Here is my code: string idString = System.Web.HttpContext.Current.User.Identity.Name; int customerID = int.Parse(idString); Customer customer = db.Customers.

.NET Core 6 Windows auth and Active Directory group based permissions

I am learning dotnet core 6, and making application for Intra. I need to get user data (user name and surname, and user groups) from company's Active Directory