Posts by Renan • 4,628 points
142 posts
-
1
votes2
answers327
viewsA: Receive List in View. Asp.Net Mvc
The error occurs because you are using null where you should pass the object with your items. Try it like this: @Html.DropDownList("SistemasComerciais", new SelectList(ViewBag.SistemasComerciais,…
-
1
votes1
answer63
viewsA: Save Object to another object’s controller
It is important you check the reason of cases of error, because suddenly it is a simple problem, as a mandatory property that should have been filled for a given scenario, or a field filled with…
-
6
votes2
answers123
viewsA: How does a method with the same name return more than one object type?
There is a design pattern (Design Pattern) so-called factory (Factory). Factory is a Design Pattern for creation of objects. To Factory knows which object to create according to the parameters it…
-
1
votes2
answers215
viewsA: Is it possible to have Identityserver4 and Authorization authentication in the API separately?
Looking at the responsibilities and the proposal itself of Identityserver4, as well as the understanding I had, the Teaching.Api application (acts as Resource Provider) is responsible for providing…
-
1
votes1
answer49
viewsA: No constructor without parameters has been defined for this object. , Asp net mvc
Add a new default constructor to your Model class (Projectoviewmodel): public class ProjetoViewModel { // Novo construtor public ProjetoViewModel() { } public int Id_projeto { get; set; }…
-
0
votes5
answers258
viewsA: How to open more than one View in a controller?
As far as I know there’s no way you can open two Views. To Action of your Controller must return a View only. But in his View you can create flaps.…
-
2
votes2
answers682
viewsA: Extract XML C#tags
To get the XML elements you can use LINQ-to-XML, I made an example in a Console application using your XML and stayed like this: using System.Linq; using System.Xml; using System.Xml.Linq; static…
-
0
votes1
answer88
viewsA: Error running Add-Migration Setup
As your RU context class (YouLearnContext) is in ddd-net-core/Youlearn.Infra/Persistence/EF/, then when executing the command Add-Migration Setup you have to select the project Youlearn.Infra.…
-
2
votes1
answer635
views -
1
votes1
answer21
viewsA: How to expose only a few table columns in a Webservice via SOAP?
You can do this using the attribute [XmlIgnore()] on the property you do not want to be serialized, in this case the CPF property: public class Cliente { public string Nome {get; set;} public string…
-
2
votes1
answer48
viewsA: How to show queries generated by EF core
One way to do it is by implementing a log provider. In your EF context class you override the method OnConfiguring informing the log provider that you will create: protected override void…
-
1
votes1
answer81
viewsA: How to save Return from a Webservice to disk?
If I understand your question correctly, the return of ws.getResultado(login, senha, xml); is already an xml and you just want to save in the directory, so there is no need for…
-
1
votes2
answers305
viewsA: Validationresult with two parameters
To use this other form of validation (via CustomValidation) you create your own validation attribute for the property you choose. In your case above, you have chosen the Subscribed status property,…
-
2
votes3
answers472
viewsA: Asp mvc how to change model data and move to another view
Asp.Net MVC can pass the data to Actions via parameters of primitive type (int, string, double, etc...) or de complex type (an object, such as Models.Product for example). In your example, using…
asp.net-mvcanswered Renan 4,628 -
2
votes1
answer194
viewsA: if condition with required Viewmodel
One option is to do a custom validation. To create custom validation of your Model need to implement the method Validate of IValidatableObject, within the method Validate you implement your…
asp.net-mvcanswered Renan 4,628 -
2
votes1
answer437
viewsA: Pass controller error to view
How did you use the RedirectToAction(nameof(Index)); the user will be redirected to Index and Modelstate is recreated, so you don’t have the value you added. There are some ways to solve, one of…
-
1
votes1
answer188
viewsA: Error while initializing database on server in Asp Net Mvc!
By mistake: "The timeout period elapsed prior to completion of the operation or the server is not responding...." This is a query/command that takes longer to execute than expected and analyzing…
-
0
votes1
answer36
viewsA: Jquery Selector in a User Control, within a gridview
I haven’t worked with Jquery on Asp.Net yet, but the syntax to get the value of the items by id seems correct. But you’ve already tested ('#idDoElemento.ClientID').val(); rather than…
-
0
votes2
answers312
viewsA: Metodo Post Angular
Why did this error occur: By security the browser prevents a web page from making AJAX calls to another domain. In this case, your Angular application runs on a domain other than your backend…
-
1
votes1
answer624
viewsA: Button on a View with MVC/Web API
If you need to make a Post, one option is to use the helper Html.Beginform to create a form, adjust your code including your HTML code in the form (within the Html.Beginform helper) and in your…
-
3
votes3
answers750
viewsA: Is it correct in a DTO class to have attributes of two or more tables?
DTO is an object created to carry data and reduce the number of remote calls. So there is no problem in bringing data from two tables into your DTO (not gambiarra :-)). Quite the contrary, doing so…
-
0
votes1
answer187
viewsA: Problem running method to insert new User using ASP.NET MVC with HTML and RAZOR
The helper Html.Beginform that marks the beginning of a form does not contemplate its fields. Analyzing your code is as if in your form there was only one button: <div class="form-group">…
-
2
votes1
answer82
viewsA: Field validation via jQuery correctly
Try to use the method event.preventDefault() to prevent the action of post be held, so: $("[id$=btnExcluirPedido]").click(function (event) { var txtJust = $("[id$=txtJustificativaExc]"); if…
-
5
votes1
answer639
viewsA: How to pass parameter to a Controller constructor?
You need to install in your project a framework Dependency Injection (DI). The Unity for example. Using the Unity you need to record and map the concrete type that will be injected when you pass…
asp.net-mvcanswered Renan 4,628 -
4
votes4
answers5886
viewsA: Git bash does not accept paste command
Commands like Ctrl+c and Ctrl+v on bash do not match copy and paste respectively. For environment Windows, the options below work: Experiment by right-clicking the mouse, thus: Or you can also use…
-
3
votes1
answer542
viewsA: Difference between Absolute Expiration and Sliding Expiration
Both allow you to configure the expiration time of your data in the cache, so I understand here, works like this: absoluteExpiration: The time the inserted object expires and is removed from the…
-
2
votes2
answers554
viewsA: Where to place a non-entity object in the DDD
Separating things: Your domain object should solve a business problem Your Automapper object (should be on another layer) avoids the need to write extensive mapping codes, thus providing more…
-
4
votes1
answer10492
viewsA: When to use Html.Beginform() and why to use it?
ASP.NET MVC has a framework helpers that provide an easy way to render HTML in Views, among them the Html.BeginForm(). Using @using (Html.BeginForm()){ ... }, the tag is automatically added…
-
2
votes1
answer318
views -
0
votes3
answers160
viewsA: Problem mapping entities related to Fluent API
You did not put in question the code that performs the data query using the context and this makes it difficult to answer. However, most likely using the Include as the code below you will be able…
-
1
votes2
answers373
viewsA: Inheritance in Entity Framework
I am not an EF specialist, but for this scenario there is the map called Table-per-Type (TPT) that looks good with what you need. Each entity is mapped to a table. Example: public class Servico {…
-
1
votes4
answers488
viewsA: How to treat this Nullreferenceexception
Check if viewmodel.Personal is void. if(viewmodel.PessoaJuridica != null) { pessoaJuridica.InscricaoEstadual = viewmodel.PessoaJuridica.InscricaoEstadual; }
-
1
votes2
answers318
viewsA: Object array in ajax with mvc
Instead: data: JSON.stringify(differs), Try it like this: data: JSON.stringify({ 'differs': differs}), Example: var cores = [ { id: 1, color: 'yellow' }, { id: 2, color: 'blue' }, { id: 3, color:…
-
3
votes1
answer84
views -
3
votes2
answers2012
viewsA: System.Outofmemoryexception error
Actually there are some problems in your code. Firstly, it is not the responsibility of Controller shoulder all these processing responsibilities. Depending on the volume of information it is…
-
6
votes4
answers1531
viewsA: Adding my files to Github
First if you have the Git installed, via command line you need to open the Git Bash navigate to your local repository directory: cd c:/seuCaminhoDoRepositorio Then you can optionally check the…
-
1
votes1
answer71
viewsA: Doubt with $http in Angularjs
As the method $http.get is asynchronous when executing lines of code console.log($scope.contatos); and console.log(st); the method $http.get hasn’t returned yet, so print Undefined.…
-
0
votes4
answers65
viewsA: After error in database insertion through c# I cannot insert remaining lines
To ensure that an instruction is executed, whether or not an exception is cast/captured in the catch, write her down in a block Finally. ... try { reader = cmd.ExecuteReader(); } Catch(Exception ex)…
-
2
votes1
answer279
viewsA: ASP NET MVC with Jquery
You need to serialize your Javascript object for JSON: function SalvarPedido() { var valor = $('#Valor').val(); var cadastro = $('#Data').val(); var data = { Id: 0, Data: cadastro, Valor: valor };…
-
1
votes2
answers1761
viewsA: ASP.NET MVC - How to Change Textboxfor’s "Name" Attribute
This attribute is case sensitive. Use Name rather than name: @Html.TextBoxFor(x => x.ToDate, new { Name = "to" }) Another example: @Html.TextBoxFor(x => x.MeuCampo, new { Name = "blabla" })…
-
2
votes2
answers766
viewsA: What is the difference between the versions of Xamarin?
Xamarin.Forms is a cross-platform framework (Android, iOS, Windows, and Windows Phone) for creating applications with XAML or C#, which unifies the writing of user interfaces for each platform.…
-
0
votes2
answers82
viewsA: C# conversion of a private void to public void
First you need to understand the problem: The body of your method with the signature private void TextDisplay_KeyPress(object sender, KeyPressEventArgs e) uses the variable "and" to detect the…
-
0
votes2
answers672
viewsA: How to pass a Ienumerable Model to a Controller?
An option would be to change the way you are rendering the text box instead of: @Html.TextBoxFor(c => item.VALORAPOSTA1, new { placeholder = "valor ", @class = "form-control" }) Try it like this:…
-
2
votes5
answers870
viewsA: Doubt with foreach com group by Asp.net mvc
Por que ocorre esse erro: The error occurs because the method "Verify securities" that you are using in View does not exist in the context of View. As the method "Verify securities" was stated in…
-
1
votes1
answer77
viewsA: Backgroundworker or Async
...Backgroudworker does the same thing as calling the function asynchronously? Yes, Backgroundworker is a class that performs an operation on another thread/background. It also allows you to check…
-
10
votes5
answers14272
viewsA: Add all the latest changes to the commit in git
I usually use the command: git add . Note: From version 2.0 of Git the command git add . amounts to git add -A. In versions 1.x, git add -A automatically add all changes (new files, modified and…
-
0
votes2
answers878
viewsA: MVC Ioc Builder without parameters
Probably his class Alocacaoviewmodel has a constructor, but is without a standard constructor. Add a default constructor to it, then test again: public AlocacaoViewModel() { }…
-
1
votes3
answers1947
viewsA: Dropdownlist validation in ASP.Net MVC
Just to illustrate how to display the message, made these two examples based on your code, where by clicking the button and do the Post without selecting an option, the screen displays the error…
-
2
votes1
answer385
viewsA: Trying to update with Nhibernate?
I’ve seen it happen when you try to work with the same object on Sessions different. Example: one creates a Session to retrieve an A object, but when saving/updating the A object you create and use…
-
1
votes2
answers344
viewsA: $Http Which one should I use?
$http get.() returns an object Promise, that allows us to chain functions as if they were synchronous. The chained function then() takes two arguments: a Handler successful and a Handler error. The…