Posts by Randrade • 21,612 points
490 posts
-
3
votes1
answer78
viewsA: Entity Framework 6 relationship
You treat normally, as if they were separate entities. public class Usuario { public int NaturalidadeId {set;get;} public int CidadeEnderecoId {set;get; [ForeignKey("NaturalidadeId ")] public…
-
5
votes2
answers89
viewsA: Access internal C#/. NET code structures
Microsoft has adopted an "Open Source" policy on its products. With this, it has released in various media the codes of various products, such as the ASP.NET and the Entity Framework, for example.…
-
2
votes1
answer339
viewsA: How to use a Masked textbox for C#time?
Just add a Maskedtextbox and add a Custom Mask for him. I think an image explains it better, so just do this: Any doubt can look at these references below: Maskedtextbox in C# Introducing and using…
-
1
votes1
answer55
viewsA: Debug Lazy loading
This answer explains very well what it is Lazy Loading and how it works in Entity Framework, but in short: In this case, Departamento is not loaded when a Training is loaded. When searching for…
asp.net-mvc-5answered Randrade 21,612 -
1
votes1
answer610
viewsA: Xamarin - Sqlite Join
Sqlite does not support .Join via linq of course. What you can do is make the consultation in hand. _SQLiteConnection.Query<PROD>( "select * from tbPROD p INNER JOIN tbITPD pd on p.PROD_Id =…
-
3
votes1
answer216
viewsA: How to return a message together with an Httpstatuscode
How can I return a message along with 404 status? In a simple way, just do this: return Content(HttpStatusCode.NotFound, "Foo does not exist."); Have a problem returning a message along with the…
-
5
votes4
answers5703
viewsA: Schedule process execution in C#
I must point out that the @Maniero response explains how to do it. I will just show a framework what use for it and suits me. But as it is a third party tool, it may not suit some day. To schedule…
-
4
votes2
answers77
viewsA: Doubt with registry edition Asp.net mvc
The error message is clear. You are passing an object of type CadastroUsuarioAplicacao and in his View you’re expecting a IEnumerable<Generico.Dominio.TB_USUARIO>. Or you change yours View to…
asp.net-mvcanswered Randrade 21,612 -
2
votes1
answer132
viewsA: Stored asynchronous Procedure
The await in his method MesesAsync() is expecting an asynchronous instruction. Just change the ToList() for ToListAsync() that will work. Your code will look like this; public async…
-
3
votes4
answers492
viewsA: In C# is it possible to use a local alias for class or namespace?
In C# it is possible to define a Namespace alias, as can be seen in the documentation. To use, just put using nomeAlias = NameSpace.Completo. An example of its use would be: using teste = System;…
-
2
votes2
answers422
viewsA: Create dynamic news site optimized for Google
The @Maniero response answers all the theoretical part behind it, I’ll just add a practical part of how to do it in Asp.net-mvc, since AP said that’s what he’s using. To add the extension .html on…
-
2
votes1
answer75
viewsA: How to use 4 model in a view
You have two (most indicated) options to do this. Do it for relationships. All of its Models are related, so you can get the properties of others just by "browsing" between them. It would be…
-
2
votes1
answer87
viewsA: How to refresh the context? ASP.NET
In your case, you’re using the Database First, which is to generate the model according to the tables in your database. You can update your .edmx usually, just follow these steps: Right click on…
-
3
votes3
answers3160
viewsA: Remove arrow from "select"
As said by @David in the comments you can use jQuery for this, seeing that only with CSS you would have some problems compared to the various existing browsers. That would be an example:…
-
3
votes3
answers783
viewsA: How to return values from two different tables?
There are some ways to do this, one of them is to return the results through a dynamic list. It would look something like this: [HttpGet] public JsonResult Autocomplete(Entities db, string search) {…
-
3
votes1
answer2876
viewsA: Instagram API get information about a particular post
Instagram is now in safe mode (Sandbox Mode). This mode began to be deployed to all customers on June 1, 2016. Before it, you were able to obtain public images through consultations with your…
-
2
votes2
answers1338
viewsA: Make Ubmit from a form via ajax
For starters, you can’t mix code C# with JavaScript the way you want to do it here: if (response.Success) { $.get('@Url.Action("Topicos", "EDisciplinas", new { idT = ' + idT + ', idD = ' + idD + '…
-
2
votes1
answer51
viewsA: Javascript error, function stops working when I add another
I took the liberty of commenting on the problem line, but this is it: document.getElementById("input_email_cad").onkeydown = function keydown_email(){ In it you are opening "Initiating" a function…
-
1
votes1
answer814
viewsA: Delete Cascade with Entity framework
Entity Framework uses some conventions in its structure. The Cascade Delete is one of them. There are some ways to remove this convention. The first, and simplest, is in the context itself…
-
4
votes2
answers222
viewsA: Entity Framework and parameterized constructor
If I pass the values of the properties through the constructor, give an Add and have them saved? EF will save normally? Yes, he will save normally. When creating a constructor with parameters, by…
-
2
votes3
answers2761
viewsA: Change active menu item depending on scroll
The answer from @Miguel already has an example of how to do, so I will just show the code of the site that was referred to in the question. How about we "steal" their source? They use jQuery and…
-
6
votes3
answers342
viewsA: How and where to implement business rules in the Entity Framework?
Your question is a bit complex in terms of implementation. Business rules are not an easy subject to discuss. There is this question where is explained a little about this. But, trying to answer a…
-
2
votes1
answer190
viewsA: Adjust height is width of Qr Coder using Messagingtoolkit.Qrcode C#
You can try changing the scale of the QR Code generated. encoder.QRCodeScale = 1; Recalling that "1" refers to the scale, in pixels, of the generated code. Reference: How to re-size Qrcode image…
-
9
votes1
answer31180
viewsA: Button (Button) inside an A (Link)? Is this a bad practice?
That question has already been answered on Soen, and it was very well answered. So I will just translate this answer. This is not valid! Just because it works doesn’t mean something is valid.…
-
2
votes2
answers3695
viewsA: Using string interpolation C# 6
You want to get the object value normally, but the variable name must be equal to the name you have in your text, for example: using System; using System.Collections.Generic; public class Program {…
-
12
votes1
answer1018
viewsQ: Minify HTML code
It is normal to see minified Javascript files, for performance gain. Today we see some sites that minify everything, including the code itself HTML, as an example east of here. (use the option to…
-
3
votes2
answers1138
viewsA: Send Boleto.net by email
In Boleto.Net’s own Github has an example of how to send to email, to check just access src/Boleto.Net.Website. Here is the example posted in .aspx, but you can adapt to your context. protected…
-
0
votes1
answer991
viewsA: Pick up Ip and Hostname of visitors who fills in contact form
You can use something like: var ip = Request.UserHostAddress; var hostName = Request.UserHostName; Recalling that the Request you can obtain various values, such as Cookies, Useragent, among many…
-
6
votes1
answer265
viewsA: How to make ASP.NET MVC skins
There is no way to say which is the best, because it will depend on what you will really need, I will explain it further below. So I will point out the strengths and weaknesses of these approaches.…
-
0
votes1
answer62
viewsA: HTML5 form validations behave differently in Firefox
Each browser has a different way of handling HTML5 validations. Google Chrome works with initial validations, that is, it will validate each field until it reaches the end. Firefox and IE no, they…
-
4
votes2
answers1185
viewsA: What’s a Seeder for?
But what would this seeder or Seed? It is nothing more than predetermined data that will be entered in the database at its initialization. It is directly related to migrations (Migrations)? Not with…
-
2
votes2
answers142
viewsA: How to add the WTFPL license to my project?
No source is better than the official license website, so let’s see what it says about this. In the FAQ page license, we have a "small" tutorial on how to add the license in your project, which…
-
5
votes4
answers325
viewsA: Loop 20 to 20 lines
If I understood your question, just create a variable with a larger scope to be your click "counter", applying the lool rule to each click. See a simple example: <p id="resultado"> </p>…
-
3
votes3
answers2266
viewsA: Entity Framework [Foreignkey]
As stated in the comments by @Maniero, it is difficult to judge whether or not the mapping is correct without the context, what can be done is to analyze and explain what the code is doing. This…
-
5
votes2
answers142
viewsQ: How to add the WTFPL license to my project?
I have a project that will have free distribution, change, copy and whatever else comes up, and I saw that there is a license WTFPL that works that way. In your site we have the text template to be…
-
2
votes1
answer234
viewsA: Recover css with jQuery
Well, I wouldn’t do it the way it is, you have a lot of "together" stuff, which makes understanding difficult. But I will leave here the simplest solution I thought. It is not the best, but I know…
-
4
votes3
answers2378
viewsA: Send a List<T> with multiple items to the controller
If you want to pass the list to the View to change only in submit, I think the best option would be for you to do the foreach() only with the selected items, this way: public ActionResult…
-
5
votes2
answers275
viewsA: Recursion in the Entity-framework
You can use the annotation in your list, or map to ignore, in your configuration. The first mode is simpler, just do this: [JsonIgnore] public virtual Instituicao Instituicao{get;set;} The second…
-
5
votes3
answers1767
viewsA: Attribute in Dataannotations for Currency
You can implement a ModelBinder for that reason. public class DecimalModelBinder : DefaultModelBinder { public override object BindModel(ControllerContext controllerContext, ModelBindingContext…
-
0
votes2
answers86
viewsA: Model, relationship with Dataannotations
Just remembering that you can indicate the mapping on own FireingnKey, in this way: public class Boleto { public int BoletoId { get; set; } public string Email { get; set; } [ForeignKey("Cliente")]…
-
7
votes2
answers2566
viewsA: Login with Windows Authentication on IIS
You cannot get the password from the logged-in user, this goes against Microsoft’s security policy. You can set up an AD account on Application Pool of IIS to make the connection, and can make your…
-
1
votes2
answers75
viewsA: My radio input is repeating
The name your radios are different. Either remove the space of everyone or put space in all. How are you: <div class="section4"> <td>Cumprimento de Horário (pontualidade dos horários de…
-
0
votes1
answer320
viewsA: Razorpdf2 - The Document has no pages
If your intention is to see on screen, change to this: return new PdfActionResult("NomeDaView", Orcamentos));
asp.net-mvcanswered Randrade 21,612 -
5
votes1
answer1063
viewsA: ASP.NET MVC Calculate value in a table
If I may, I’ll use foreach for the answer. Just do the same loop calculation, example: <tbody> @foreach(var item in Model.Detalhes) { //Não sei qual a regra que você precisa, então farei uma…
-
4
votes1
answer105
viewsA: ASP.NET shares resources in the same pool?
You can share IIS resources as you mentioned, but not automatically. To do this. you need to configure your IIS for this. You can see a little here. There are also some examples here and here. But…
-
28
votes4
answers1189
viewsQ: How does a search engine work?
I am making it clear that I am not asking how to make my site appear better in the search index. Today we have several search engines. Some very well known as Google and Bing and others not so much,…
-
10
votes1
answer1084
viewsA: How to calculate the ratio of text to "HTML" ("HTML ratio")?
What is HTML Ratio or HTML Text Ratio? HTML ratio is nothing more than the percentage of actual text on your html page. On an HTML page we have Text and HTML Code, the apportionment is the…
-
5
votes3
answers538
viewsA: Average only in typed fields
Using only javascript you would only need to get the values of inputs and check if they have value. If you have, simply add normally and increase the amount to be calculated. Would look this way:…
-
2
votes2
answers205
viewsA: Media Queries for Java Script - What is the error in this syntax?
I believe if you remove the @media all and will work. var mq = window.matchMedia('(max-width: 768px)'); if (mq.matches) { console.log('menor'); } else { console.log('maior'); } <script…
-
2
votes4
answers657
viewsA: How to organize many Ivs in Bootstrap (Image)
Well, on the margin between the div’s, just change the CSS on your page, changing the margin. .col-md-3{ margin: 0 5px 5px 0; } Regarding the size, I believe you do not know the size of each text to…