Most voted "asp.net-mvc-5" questions
This tag should be used when the question refers to some features only available in version 5 (currently the latest) of ASP.Net MVC. ASP.NET MVC is an open-source Microsoft framework that implements the Model View Controller architecture standards for web development. Based on ASP.Net, allows software developers to build web applications following the Model View Controller architecture standards.
Learn more…937 questions
Sort by count of
-
4
votes1
answer139
viewsHow to make a video file available for viewing in the browser as PDF?
How to make a file available for download and viewing in browser? For example, files of the type pdf and mp4. When I want to make available to download the file I simply use the following routine:…
-
4
votes1
answer955
viewsEdit field within a list in Asp.net MVC
Guys, I’m developing an application that manages Courses, and I’m trying to make a list where present on the screen the Courses, the Student Name and the countryside Approved, where it indicates…
-
4
votes2
answers1180
viewsValidationsummary - Asp.Net MVC problems
I’m having problems with Validationsummary in my application that manages Courses, I have a screen where the student enrolls in a course and in case he tries to enroll in it course again should…
-
4
votes2
answers2052
viewsUpdate page(View) automatically in Asp.Net MVC
Guys, in my application that manages Courses, i have a sign-up screen, where the student clicks on the button "enrollment" and enrolls in the course, and the amount of vacancies field is decreasing.…
-
4
votes1
answer256
viewsConvert LINQ to Dapper query
I have a LINQ query where I get the complete data. Because of performance, I am converting the query and using Dapper. I have the following entities: public class Cliente { public int ClienteId {…
-
4
votes1
answer682
viewsSend only object from the list that has changed to the controller
I own a view who lists all my customers. Each customer has 3 checkbox where the user selects them, and sends them to the controller - through the button (Submit) - the data to change. The method is…
-
4
votes1
answer2279
viewsLoad Datatable with Jquery and MVC 5
Good morning!, I read some articles about Datatables.net, for example: Datatables.net - Examples index Load tables with json using Datatables Using jquery Datatables with ASP.net MVC 5 but I cannot…
asp.net-mvc-5asked 9 years, 2 months ago hard123 2,329 -
4
votes1
answer1852
viewsHow to use @Html.Validationmessagefor to change the text box class
I bought a bootstrap template, the validation of the controls is done by a class that leaves the controls red. This would be the classes form-group has-error Only that I never used this way, I’m…
-
4
votes1
answer67
viewsHow to separate a fixed route from a variable route with Asp.net mvc5
I have a control that manages videos. I’m trying to make these two methods: [Route("video/categoria/{categoria}")] public async Task<ActionResult> Index(string categoria) { }…
-
4
votes1
answer77
viewsI can’t save a Dictionary
I have a page that may have unauthorized access, open for reading or open for reading and writing. Even if the page is completely closed, the owner of the page can choose some users of the system…
-
4
votes1
answer668
viewsCalculation of hotel nights in MVC application
I recently started programming in MVC and I am full of doubts. I’m developing a hotel reservation system and after spending 3 days trying to calculate the total cost of a reservation unsuccessfully,…
-
4
votes1
answer1975
viewsCalling an asynchronous function in an Actionresult?
How to make the call of an asynchronous function on a non-asynchronous controller, to be clearer follows a situation: I have a form that when saving it needs to store data in the database and…
-
4
votes1
answer665
viewsHow to pass a txt file to a Stream type parameter?
How to pass a file txt for a Stream type parameter? That’s the ActionResult which calls the method to read the file txt: [HttpPost] public ActionResult Incluir(ContaReceberViewModel pContaReceber,…
-
4
votes1
answer302
viewsProblem with left Join using Entity framework
I’m having a problem performing a left Join on Asp.net mvc. I own a view that lists all screens of the system, the same are registered in the database. I created a table of type (tab), screen and…
-
4
votes1
answer623
viewsRedirect to error page when entering catch
I have a question as to a possible improvement in the method when an error occurs in a Action and redirect to an error page. At the moment, I do so on Action: public ActionResult Index() { try {…
asp.net-mvc asp.net asp.net-mvc-5 asp asp.net-mvc-4asked 8 years, 5 months ago Leomar de Souza 1,074 -
4
votes1
answer100
viewsTextboxfor returned Null Post
I have a form where I query an API using jquery. The query returns the data and fills the textboxfor with this data : $.getJSON("//viacep.com.br/ws/" + cep + "/json/?callback=?", function (dados) {…
-
4
votes2
answers15005
viewsHow to place an image in an HTML button
I am creating a button on a given page and would like to put a background image. I’m trying to tag background-image:url() in CSS but not working. HTML: @model…
-
4
votes1
answer151
viewsUnique contexts of authenticated users
Using the @Gypsy recommended method in this answer (It is possible to leave connectionString dynamically?), I was able to get a dynamic connection, and using the idea of mapping a context with the…
-
4
votes2
answers1274
viewsHow to redirect user to page after login?
I am developing a web application, using Asp.Net MVC 5 com Identity and I’m using Roles to carry out the authorisation. I’m trying to do that depending on the Role that the user has, it is directed…
-
4
votes1
answer991
viewsHow to use login in different areas on Asp.net mvc
I’m creating an app, where it has more than one Area, which is restricted. (as shown in the image below). My question is how to login in different areas? Details: As users of the Admin area and the…
-
4
votes1
answer691
viewsHow to recover logged in user name and display in View
I’m trying to develop a page, where after the user login, it is redirected to an index, where I would like to display the user name. I’m using Identity default of ASP.NET MVC. So I thought I’d put…
-
4
votes1
answer1201
viewsHow to update a Dropdownlist without refreshing the page
I have a State Dropdown, and a City Dropdown, and a zip code field, which is making use of the mail online API, when I put a zip code, my system checks whether the city already exists in the…
-
4
votes2
answers392
viewsOpen View with Parameters
I have this Script: $('#Musico').change(function () { var id = $(Musico).val(); var url = '@Url.Action("Votar","Chamada")'; var tipo = 1; $(function ChamaVotar() { $.post(url, { id: id, tipo: tipo…
-
4
votes1
answer78
viewsHow to make Selectlistitem substring?
Follows the code: View: @model IEnumerable<Projeto.Models.Model> <table class="table table-striped"> <thead> <tr> <th> @Html.DisplayNameFor(model => model.Id)…
-
4
votes1
answer607
viewsFormat @Html.Label - MVC
On my page I have one: @Html.ActionLink(linkText: "Bem Vindo(a) " + User.Identity.GetUserName() + "!", actionName: "Index", controllerName: "RelatorioTagModels1") Which generates, the "Welcome" page…
-
4
votes2
answers2552
viewsClaims Identity MVC
I’m having difficulty implementing Claims to make user authorizations in my project, I’ve read a lot but I can’t execute it. I’m using in the project the Nhibernate.AspNet.Identity may be that for…
c# asp.net-mvc asp.net-mvc-5 asp.net-identity fluent-nhibernateasked 7 years, 5 months ago Eluander J. F. Lopes 400 -
4
votes2
answers94
viewsHow to perform a Where using Entity Framework
I have a web application that I need to present a list containing some data, for that, I created the Model: Crm_Analise: public class Crm_Analise { [Key] public int id { get; set; } public string…
c# sql-server entity-framework asp.net-mvc-5asked 7 years, 4 months ago Thomas Erich Pimentel 3,059 -
4
votes1
answer549
viewsAjax Request Does Not Work - Success Does Not Work
I did the following function: $("#CategoryList").change(function () { $("#SubCategoryDropDown").empty(); $.ajax({ dataType: "json", url: '@Url.Action("GetSubCategory", "ProjectSubCategories")',…
-
4
votes1
answer107
viewsBeginform from ASP.NET does not apply route mapping when making the request
I have a route problem(again), I use the ASP.NET MVC5, and I have the following route mapped: routes.MapRoute( "Search_route", "Home/Search/{search_input}/{search_input_category}", new { controller…
-
4
votes2
answers1153
viewsHypothesis tests with C# - Merge (sum) of values to find result
Hello, everybody. I need to solve the following problem using C# (ASP . NET MVC): I have a table in the database that contains ID and Value (decimal) as below: id: 1 | value: 100,00 id: 2 | value:…
-
4
votes1
answer37
viewsOther account data with facebook authentication
I am implementing authentication by facebook and wanted to, when entering the application with the account data, save also full name, photo, among other data. Searching, I got the following code:…
-
3
votes4
answers7116
viewsHow to hide the time of a "Datetime?" field in the user interface?
The time is appearing for the user. My question: it is possible to hide the time and show only the date? How are you showing: Model code: View code:…
-
3
votes1
answer5980
viewsHow to pass parameter in an Action Link values that are in HTML elements?
I have 2 HTML elements, a TextBox and a Hidden, which have values, how to pass the values of these elements in the Action link parameter? Below the parameters docItemId and vlrImobIcms are making a…
-
3
votes3
answers553
viewsWhat is the difference between a web service in the same project and a different project in the same project?
Everyone tells me to create a REST and not SOAP. I know I’ll only get it well doing. I picked up an old project at the company where I’m with a web service in the same project. As I’m using MVC, I…
-
3
votes2
answers954
viewsFilter on Where the longest date with LINQ
As I pass the Where of this max datatransaction, ie I wish to bring the result but by the highest date. var resultado = (from ci in webDB.T_Controle_Importacao where ci.CNPJ == cnpj let dd =…
-
3
votes1
answer611
viewsError while passing Adddays in Lambda expression
In this lambda, gives me the error below, when it enters the IF: var resultado = webDB.T_ControleColetor .Where(cn => cn.CNPJ == cnpj) .Where(dt => dt.DataControle == DateTime.Now.AddDays(-1))…
-
3
votes1
answer1832
viewsHide parameters in the URL with routes and mvc 5
I have a route like this: routes.MapRoute( name: "RotaConteudo", url: "Conteudo/{name}/{Parametro}/{tipo}", defaults: new { controller = "Conteudo", action = "Conteudo", name = "", Parametro = "",…
asp.net-mvc-5asked 10 years, 8 months ago pnet 14,727 -
3
votes2
answers3617
viewsMy javascript function does not call controller action
I have this javascript function. function loginUsuario(){ alert(); if(($('#txtUsuario').val() != "") && ( $("#txtSenha").val() != "")) resultado = JQuery.parseJSON('{"Usuario": "' +…
-
3
votes4
answers5635
viewsMake a regex to remove characters
In a return of a jquery function, the date returned comes in this format. /Date(1401731794773)/ I would like to remove the invalid characters on that date, which are: /Date( and )/ I only need the…
-
3
votes1
answer7349
viewsHow to access the application from another computer running on localhost
I have a web application made in ASP.NET MVC 5, and gave a start in Visual Studio 2013, the address of the Index page was like this on the machine where it is running: http://localhost:51144/. How…
-
3
votes1
answer290
viewsQuestions regarding the use of . dbml files
I took a system in aspx(VS2008) and I will have to make some improvements, add other features and all this using MVC5. Well, there’s a web service, there’s a guy like that: static…
-
3
votes2
answers449
viewsMapmvcattributeroutes with Pagedlist.MVC
I’m using the routes.MapMvcAttributeRoutes(); to decorate my actions with the Url I want to appear in the browser, and it has worked very well, however, when using with the PagedList I’ve been…
-
3
votes2
answers2764
viewsIF condition inside _Layout.cshtml in MVC
I have two _Shared.cshtml (MVC masterpage type, do not know the name) and both are virtually equal, only the menu left is different. I would like to do only 1 and according to the querystring I will…
-
3
votes2
answers1034
viewsLog in with network user
When opening the page I am building, the user who is logged in by the network, he or she will login to the page with this user, but without having to open a page for this, that is, my system will…
-
3
votes1
answer68
viewsEntityframework 6 - Load Model and its dependencies in Home
I have a college project where I decided to do a blog. Something very simple, author, post and comments. only these three. Well First I wanted to home of the project he carried the Posts (Articles)…
-
3
votes1
answer161
viewsPreloader Asp.net MVC
How can I do a preloader(carrying...) while it is rendering the view on @RenderBody ? In search only found examples using Partial, but Views not Any idea?
asp.net-mvc-5asked 10 years, 3 months ago Rod 9,412 -
3
votes2
answers372
viewsreturn view with empty model
I do Ubmit to save, and I want it to return in the same view, but with empty fields, a new model, so it can add again But he always comes back with the data I filled out My action is like this:…
asp.net-mvc-5asked 10 years, 3 months ago Rod 9,412 -
3
votes1
answer981
viewsYou can pass the roles without using [Authorize(Roles = "Role name")]
My system has dynamic roles("groups"), the user adding and putting users in. Also arrow that if it can insert, edit, delete, etc... With the use of Asp.net Identity Roles, he can do this…
-
3
votes1
answer943
viewsMVC 5 and EF 6 Putting Form from another view
Keeps giving comment error null in this line: ViewBag.PostId = new SelectList(db.Posts, "PostId", "Titulo", comentario.PostId); Probably why you didn’t sing in the ModelState.IsValid. I’m doing a…
-
3
votes1
answer1314
viewsWhat is and how does Claims work on Asp.Net Identity?
What is and how Claims works on Asp.Net Identity? In what real-use example would we use Claims? What is the advantage of using them? Sample codes?
asp.net-mvc-5asked 10 years, 3 months ago Rod 9,412