Posts by Leandro Angelo • 9,330 points
440 posts
-
1
votes1
answer99
viewsA: How to make the Return Ok<Object> take multiple arguments
You are not returning an object, but rather a collection... And the method Ok() cannot receive a generic argument of type. Below follows an alternative, far from being the most elegant form...…
-
0
votes1
answer87
viewsA: Taking values from a form using a model
If your model expects a collection of checkbox your form should provide this to her. And how it will find these inputs inFormData is through the attribute name. It is unclear, in your question, how…
-
1
votes3
answers1381
viewsA: How to declare an object parameter as null in C#
If the property that receives the object type Livro which can be null, just indicate this in the declaration of your class. public class Biblioteca { public int Id {get; set;} public string Nome…
-
2
votes1
answer299
viewsA: Disable certain options from the default menu context
In principle it is not possible to enable or disable these menu options. As it appears in the cited example may be related to how the content is being delivered to the browser and that it cannot…
-
2
votes1
answer484
viewsA: How to resolve lambda expression conversion error of type Servicelifetime net core?
You are trying to add context to your and entity Menu and not for the class that actually inherits the DbContext which in this case is the Ctx. Change your code to…
-
1
votes1
answer43
viewsA: Pick up time from the nearest array to the current time
If you convert the string to Datetime, you can calculate the difference between the record date and the current one using Math.Abs() in the OrderBy() and catch the first result. var result =…
-
1
votes2
answers92
viewsA: converts from Vb to c#
If you want to increment the value that is coming as "000001" and fill in with zeros again, you must convert the value to integer and use the PadLeft() for the completion. If you try to carry out…
-
0
votes1
answer29
viewsA: Scan barcode for product data
Yes and no. Each company can generate the code they want for their barcodes. However, for commercial interests the major brands define their standards and there are some initiatives that centralize…
-
1
votes1
answer53
viewsA: How to create a list or dictionary from a datatable?
If you want to use one Dictionary to store these values you can build a Dictionary<string, list<string>>, incialize it and then popular with the distinct values, see the example below.…
c#answered Leandro Angelo 9,330 -
0
votes1
answer71
viewsA: How to find the index of a Datarow by the value of a Datatable column
I don’t think it makes sense to search for an item by its description instead of its code... as well as the mapping of DataTable for the combo box could be made more practical... But follows an…
-
0
votes2
answers438
viewsA: Route mapping does not work in ASP.NET Core 2.2
The project you are working on is not from the template MVC, the route you say does not work because there are no controllers or views in that structure. You started your project by choosing the Web…
-
1
votes2
answers361
viewsA: Export large amount of data to Excel
If your goal is not to freeze the user interface, you can start a new Task to accomplish this task, but this will not solve the question of time for the execution. private void…
-
0
votes1
answer43
viewsA: getters and setters do not work with Httpget
No problem at all with your setters, the error may be in the way you are making the request, see the demo below. However, note that in assigning the variable teste where the…
-
1
votes1
answer51
viewsA: Parameter Crossing in ASP.NET
The error happens because you are trying to access a session key that has not been declared... to avoid the error you can simply check if it exists before making the assignment. private void…
-
0
votes1
answer328
viewsA: If I declare a global variable for my page, is it accessible only in this session?
There is nothing global in your code, just the string id that will always be initialized with the value "rd1" every time the class espelho_de_vendas is entered, it will receive this value, which can…
-
1
votes1
answer63
viewsA: Onserverclick is not running
So that the bind of onserverclick work it needs to be declared physically in your aspx. This is because in the render event and before the Page_load ASP.Net will parse your content and replace your…
-
1
votes1
answer54
viewsA: Create a label when reading data from a file
My suggestion is to store all label information in a single file, separating the attributes by ;. If what matters is the information that has been persisted, not the need to per other loop for this…
-
4
votes2
answers609
viewsA: Difference between ?. and ?? in C#
See the following example structure: class Pai { public string Nome { get; set; } public Filho Filho { get; set; } } class Filho { public string Nome { get; set; } } If you run the code below, you…
-
1
votes3
answers749
viewsA: Format string for JSON
Following the format presented in the first part of the question where the property to reflects the following structure "to":"[123456,12354]"... You can simply interpolate your string. string json =…
-
3
votes1
answer116
viewsA: Where is the database used by IIS
You should not use localDB in the production environment, it is a resource intended only for the development environment. By default the . mdf of it is created inside the user folder in…
-
2
votes1
answer144
viewsA: Private unit attribute test of a class / C#
At that point is that the practices of the TDD comes to the surface. These private properties should not be tested. Either they should be public, or their inaccessibility shows that they are lacking…
-
2
votes1
answer71
viewsA: Error connecting to database (mysql) using entityFramework
Your connection string is wrong, remove the " and replace the "es for ' <entityFramework> <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory,…
-
1
votes2
answers106
viewsA: How to set the first position of the list in Javascript?
To the select2() you can set the value of your option and disahalt the change event. $(document).ready(() => { $('#idUJ').select2(); //seleciona o valor da posição desejada let valor = $("#idUJ…
javascriptanswered Leandro Angelo 9,330 -
0
votes1
answer59
viewsA: I’m trying to create several albums on my site but keeps appearing only the first created
The element <img> does not accept as attribute for the property src an archive html, your proposal is to display images. <img src="quartoun.html" alt="" class="min"> (This will never…
html5answered Leandro Angelo 9,330 -
0
votes2
answers46
viewsA: Footer is repeating when I press Partialview in the dropdown change
make sure that your Partialview is not loading the layout of the master.. which may be coming from _ViewStart @{ Layout = null; } <table class="table"> <tr> <th> Nome </th>…
-
1
votes1
answer679
viewsA: How to remove favicon from an HTML page?
In addition to removing the <link rel="icon" href=""/> of your html. Delete the file .ico or favicon.png from the root of your website. The browser may end up using this file by default even…
htmlanswered Leandro Angelo 9,330 -
3
votes1
answer39
viewsA: Related entity on page Razor
You must use the "complete path" @Html.EditorFor(model => model.Endereco.Logradouro)
-
1
votes1
answer67
viewsA: Access xml files from a directory c#
You need to upload the file since your method expects one XmlDocument... when you do that lerXML(a.FullName), is passing a string and not a representation of the document. System.IO.DirectoryInfo…
c#answered Leandro Angelo 9,330 -
0
votes1
answer163
viewsA: How to check if you are registered through Monthecalendar ? C#
Without presenting your code and structure not how to detail more, but see the example below of an approach that can help you... Hypothetical model structure for scheduling: public class Agendamento…
-
1
votes1
answer32
viewsA: Pass controller(action) information to a jquery function and vice versa
If you want to return the rendered html from the view, just use the load method()... $(document).ready(function () { $('#faturarParaDrop').change(function () {…
-
0
votes1
answer50
viewsA: Page flashes when giving F5
Avoid completely, I believe you do not have a definitive solution, but there are some practices that will help you mitigate this problem, some done on the client side and others on the same server.…
htmlanswered Leandro Angelo 9,330 -
2
votes1
answer31
viewsA: Fileinfo.Length gives wrong size
You are measuring the string size and not the file size, the problem is not in the FileInfo.Length but yes in your code. Now if the FileInfo.Length is returning 0 bytes to you, it is because you…
-
1
votes1
answer45
viewsA: Do not open window if fields are not filled in
Since you are already decorating the inputs with the required attribute, just check if the form is valid, you can use the method checkValidity();. $(function() { $('#chkveg').multiselect({…
-
3
votes1
answer512
viewsA: Serialize composite object into a single json
Simply assemble a new object with the desired structure for serialization. var person = new Person { Name = "Leandro", GeneralText = "teste", Address = new Address { Street = "Visconde de Nácar",…
-
0
votes2
answers107
viewsA: Browse Array and view in table
Instead of writing three arrays, I would recommend that you represent this content in an object structure for javascript itself... so you could later change your script to deliver this content…
-
2
votes1
answer248
viewsA: Debugger does not work
Except for some points to be noted here, you are declaring your strings in javascript without using quotes... The result of vd = @obterDado2(); would be vd = True; and not vd = "True";, see the…
-
0
votes1
answer41
viewsA: Delete data from hidden fields with javascript
Add a <form> and use the method reset() to clear data when changing customer type. $('#radioBtn a').on('click', function() { var sel = $(this).data('title'); var tog = $(this).data('toggle');…
-
3
votes1
answer37
viewsA: Tag html in Jquery
You imply that you are adding the options to a <textarea>, the line break for this element is not the <br>, but rather the \r\n. Also no need to replace all content, just add the new…
-
1
votes1
answer46
viewsA: Error returning a JS function
The Return is illegal because the code you are presenting is not a method or Function that where there should be a return. Your content is available in the variable base64String. var canvas =…
-
1
votes3
answers51
viewsA: This code n creates a <li> with the value specified in the function, what am I doing wrong?
There are two points here, first the button is of type submit that will execute the sending of the form, which by not having an address set to action, will cause only the refresh of the page and…
javascriptanswered Leandro Angelo 9,330 -
0
votes2
answers121
viewsA: Calendar javascript conflict between single quotes parameters x double quotes
I wouldn’t recommend, this mess with to concatenate a string that can be interpolated. This will make your code more readable and less susceptible to this type of error. See the example below. let…
javascriptanswered Leandro Angelo 9,330 -
1
votes1
answer311
viewsA: Data Passing from an SQL Query to an HTML Table
The big problem in your question is either a typo or you disregarded Javascript’s sensitivity to box variation. You declare the variable Operadoras and tries to assign values to operadoras. But…
-
0
votes1
answer57
viewsA: Contact form on an intitucional website
It is a little mistaken to say that it is impossible to send a form without a backend... It’s just not practical and depends on features on the user’s machine, like a configured email client. The…
htmlanswered Leandro Angelo 9,330 -
0
votes1
answer20
viewsA: My panel dont close
Maybe because you never update the variable isOpened if the Update() runs each frame and it runs the Goto_Hack(), isOpened will always be false... Besides, it doesn’t make any sense for you to…
-
1
votes1
answer141
viewsA: Return json from query Inner Join ASP.NET WEB app C#
The error is in trying to access properties of an object that has not been initialized, in your case patrimonio class Marca, in her question she does not even own the getters and setters public…
-
3
votes3
answers42
viewsA: Keep images online even on mobile devices
Remove fixed values and assign relative values. #share-buttons { width: 100%; } #share-buttons a { width: 18%; height: 100%; display: inline-block; } #share-buttons img { width: 100%; max-width:…
-
2
votes1
answer1027
viewsA: Mask accepting letters and numbers
You can indicate to which position you can receive a letter using the A $("#FormaCalculosVencimentos").mask("A00,A00,A00"); <script…
jqueryanswered Leandro Angelo 9,330 -
0
votes2
answers669
viewsA: Invalid character in HTTP Request C#
The accent you resolve with the CultureInfo in his StreamReader string Query = "teste"; string sURL = "https://www.google.com/search?q=" + Query + "&sourceid=chrome&ie=UTF-8"; HttpWebRequest…
-
0
votes1
answer36
viewsA: Hiddenfield in aspx to cshtml
In Razor you can use the @Html.HiddenFor() which will be very useful if you are using a Model @Html.HiddenFor(m => m.Propriedade) Otherwise, as in the example presented in the question... it does…
-
0
votes2
answers102
viewsA: Add new checkboxes with ajax
You only bind the event in the checkboxes that are already present in the page load but not in those that are added dynamically... A shortcut is to use a method for the event routine and declare in…