Posts by Randrade • 21,612 points
490 posts
-
7
votes1
answer1013
viewsQ: Press "Guide" to search the site?
Recently I went to the site of Sopt by Google Chrome and I came across an interesting feature that is the "Tab to Search" (Omnibox). In short, by typing the address of a website and pressing the…
google-chromeasked Randrade 21,612 -
11
votes4
answers5749
viewsA: Input type NUMBER does not consider maxlength
According to the MDN documentation, you can only use the maxlength for the guys text, email, search, password, tel, or url. That was a design decision. If you wish, you can use the min and max…
-
7
votes2
answers2696
viewsA: Regular expression
You can use the expression [^0-9] to obtain only the numbers. An example would be this: String tel = "(99) 9 9999-9999"; String cpf = "111.111.111-11"; String cnpj = "11.111.111/0001-11";…
-
4
votes2
answers646
viewsA: Sort Dropdown with jquery after append
You can create a function to do this and call after the append(). This question has several examples of how to do this. function OrdenarSelect() { var selElem =…
-
4
votes2
answers4753
viewsA: Adding values between html and javascript inputs
The first thing to do is arrange your function to add rows in the table. When observing the line below, we can observe that you forgot the quotation marks when placing the ID of input. With that,…
-
9
votes2
answers9843
viewsA: Export to excel via javascript, put name in file
You could do something like this: $("#btnExport").click(function(e) { var a = document.createElement('a'); var data_type = 'data:application/vnd.ms-excel'; var table_div =…
-
1
votes2
answers86
viewsA: Need for Sqlite
In a direct way, if you nay need to save data on device, do not need Sqlite. There is no reason to add something to your code that you will not use (see exception). Let’s take a look at your…
-
2
votes1
answer415
viewsA: How to return only the ref. data to the logged in user
If you want to get the username logged in, just use the following code: public class CombustivelController : Controller { private CombustiveisContext db = new CombustiveisContext(); // GET:…
-
2
votes1
answer143
viewsA: Error while trying to generate Scaffolding
The error is very clear. He says that his model does not have a Key defined, i.e., the VS did not understand that its class Combustivelmodels possess a key Primary. The reason for this can be some…
-
3
votes2
answers490
viewsA: How to save data to SQL database - Submit
First step, update your IdentityModels to map your model in this way: namespace OneeWeb_v2.Models { // You can add profile data for the user by adding more properties to your ApplicationUser class,…
-
1
votes1
answer878
viewsA: Div with load overlap
Basically, just add the following properties to the CSS: .mask-loading { position: absolute; top: 0px; left: 0px; z-index: 1000; background-color: #000; opacity: 0.5; width: 100%; height: 100%; }…
-
5
votes2
answers6439
viewsA: Serializing and Deserializing Json objects with C#
As stated in the comments, your problem is in the "Mapping of objects". In summary, you need to specify the form that the object will be "deserialized". Some cases are even complex, and use a tool…
-
2
votes2
answers828
viewsA: Abort Thread through another C#process
Well, the first necessary thing you’re already doing, which is to save the Managedthreadid. For the user to abort, you also need to save the list to show only his, but that’s not what the question…
-
6
votes2
answers474
viewsA: Validation without "Modelstate.isValid"
The ideal is to validate by ModelState, as shown in the response of @Eduardosampaio. But you can validate otherwise. To do the validation, you need to use the Validationcontext class. An example…
-
3
votes2
answers540
viewsA: How to sort with LINQ with one LIST<T> inside another?
I didn’t quite understand your doubt, but it’s not enough to order the return? public static void Main(string[] args) { Combo combo = CarregarCombo(); foreach (var grupo in combo.Grupos.OrderBy(g…
-
3
votes1
answer608
viewsA: Get windows logged in user to automatically authenticate on a website published in IIS 7.5
Unfortunately, or fortunately, there is no way to standardize. This goes from browser to browser. In Internet Explorer and Google Chrome it can perform this authentication automatically. If you want…
-
2
votes1
answer34
viewsA: Using Code Snippet in HTML5
There is the xmp element, which is obsolete and the use of element pre. Below is an example of the use of XMP: xmp { background-color: #eff0f1; } <xmp> <!DOCTYPE html> <html>…
-
0
votes2
answers922
viewsA: Recover External IP without third party services
You can use the IP Public Knowledge. install the Nuget package: Install-Package Ippublicknowledge An example of use would be this: var ip = IPK.GetMyPublicIp(); var IPinfo = IPK.GetIpInfo(ip);…
-
5
votes2
answers293
viewsA: How to destroy a $Scope. $watch?
I particularly found it a little strange how to do this, and I don’t know if you have another one. However, just declare a variable for the Whatch and "call you" when you no longer wish to observe.…
-
0
votes1
answer906
viewsA: GOOGLE MATRIX API
According to Google, not all routes have routes. This is common when you search places far away or that do not have direct highways. I don’t know if you tested it, but or directly on Google Maps it…
-
27
votes5
answers7016
views -
9
votes4
answers199
viewsQ: Difference between syntax to declare a function
Reading this answer, I realized different forms of call for a function using jQuery. The first way would be this: $('#dois').on("click", testar); function testar() { console.log('Teste Dois'); } And…
-
5
votes2
answers1051
viewsA: Copy data from one field to another
Only with Javascript can you do something like this: function copiaValor() { var celular = document.getElementById("campo1").value; document.getElementById("campo2").value = celular; }…
-
5
votes1
answer691
viewsA: How to recover logged in user name and display in View
No need to define this model in the View (not for this). To access the Username user, just put the code directly in the View, this way: <h2>@User.Identity.Name</h2> The fact that you can…
-
3
votes3
answers1351
viewsA: Change String Axis Y Google Chart
What you seek is customization of the Axes. In your case specifically, it is vAxis. To suit your example, folder change chart options for this: var options = { height: 600, vAxis: { title: 'Rating…
-
2
votes1
answer332
viewsA: Sort datatable.net jquery by date
Depending on the version or the files you use, it does not have the extension to sort by date. To change, simply add the Datetable date-euro in your project and add the column that should be…
asp.net-mvcanswered Randrade 21,612 -
1
votes2
answers611
viewsA: Fix rows in table
First of all how about organizing your table? Use the tags thead, tbody and tfoot for better organization of your table. Read more about this in this answer But the answer you’re looking for would…
-
5
votes1
answer82
viewsA: If Else of date
You can use the method .Adddays(). With it you can pass a positive value to add days, or a negative value to subtract. if (item.DataHora > DateTime.Now.AddDays(-1)) { //codigo } See a example in…
-
4
votes2
answers475
viewsA: What is the purpose of automatically generated directories in an ASP.NET MVC project?
First of all, I must point out that most folders are suggestions, and do not necessarily need to be used as they are. That said, I will make a brief explanation of each folder. App_data This folder…
-
1
votes1
answer631
viewsA: Pass a JS variable as the Url.Action parameter
You can’t mix it up javascript with Razor. To do what you wish, you’d have to do something like this: <script> function check() { var teste1 = document.getElementById("lala"); var teste2 =…
-
1
votes1
answer77
viewsA: Extract information from requests header in Fiddler
I don’t know if I understand you very well, but if you want to reclaim the value of Header of the request, just do the following: var teste = HttpContext.Current.Request.Headers["Content-Type"];…
-
1
votes1
answer1548
views -
4
votes1
answer636
viewsA: create link with file download
Hugo, for security reasons, you can’t do this manipulation. To appear the option to show the window where the file must be saved, the user must mark this option in the browser settings. For example,…
-
4
votes2
answers337
viewsA: V4 and V7 on Android
In short, they are the Support Libraries android. Android features numerous versions, and in each new version new Apis are created. However, your application is usually not only developed for the…
-
4
votes1
answer8493
viewsA: Generate Excel in SQL SERVER
I am updating the answer with the export form via SQL command. You can just copy and paste the data into an excel file as shown in the image below: Sql Server also has a "Wizard" to do this export.…
-
5
votes2
answers151
viewsA: How to remove Progressbar margins?
By default, the progressBar has a fill above and below, which can be removed in some ways, as: Margin: You can set the margin to a negative value, thus removing the spacing. An example would be…
-
8
votes2
answers819
viewsA: Show animation during loading?
When we analyze what happens with Facebook, we can see that it has a fixed HTML page, and continues loading the other items via requests to the server. The image below shows a bit of what is loaded:…
-
0
votes1
answer32
viewsA: How to List Added Photos in View?
There are several ways to do what you want. The simplest is to have an element img in your code, and when selecting the image (in this example I am using the .change()) you add the image. A basic…
-
0
votes1
answer367
viewsA: set position of scrollbar in an iframe
You almost got. Test just add your code on $(window).load() and see what happens. $(window).load(function(){ jQuery("#iframe").contents().find("html,body").animate({scrollLeft:100}, 1000); }); See a…
-
6
votes2
answers2239
viewsA: Enable and Disable Save Button
Using the reply from @ggui as a basis, you can save the field value with the event .phocus() and by .change() or any other event you are using, you perform the check whether the value is equal or…
-
2
votes1
answer510
viewsA: Get name of all fields with the required tag
I don’t know if I understand you very well, but that’s what you’re looking for? function myFunction() { var inputs = []; jQuery('[required]').each(function() { //console.log(this);…
-
3
votes1
answer269
viewsA: Login to index screen
This is very wrong (don’t get me wrong): <form class="navbar-form navbar-right" role="search"> @*@using (Html.BeginForm()) { @Html.AntiForgeryToken()*@ <div class="form-group"> <input…
-
1
votes2
answers544
viewsA: Change Color of an Error Message using Annotation
There are some ways to do this. Only with CSS According to To Microsoft these are the error classes you will have: field-validation-error. Defines the output of the Html.Validationmessage method…
-
2
votes1
answer669
viewsA: How do my ASP.Net MVC project view folders with images?
There’s something wrong with your code and not "mapping". If you look at the path he’s trying to look for the image is: http://localhost:1739/assets/img/user.png However, in its image it clearly…
-
2
votes1
answer692
viewsA: Update Object List via Entity Framework
A simple way to do this is by using the Entity Framework Extended. First, just install the library via the following Nuget command: Install-Package Entityframework.Extended Then just update. An…
-
3
votes4
answers86
viewsA: Hiding div by jQuery
In short, you’re using two if() and without any return. That way, it will enter both. An "alternative" (gambiarra in my opinion) would be to put a return on if(). It would be something like this:…
-
0
votes1
answer65
viewsA: Solution for Getrange error when accessing elements outside the list
The error is clear, as you said yourself. With the .GetRange() you are passing the value above the amount of items in the list. To continue using .GetRange(), you would have to treat for it not to…
-
5
votes2
answers120
viewsA: How to move form on screen programmatically with animated effect?
I think the simplest way to do what you want is to use the library Winformanimation. To install, simply use the following command: Package Manager Console: Install-Package Winformanimation Once…
-
0
votes2
answers910
viewsA: Redirect users to Google Maps app using Waypoints
There are two ways you can do this. Geo You can use the Android geo API for this by passing the address or coordinates. An example of use would be like this: <p><a…
-
2
votes2
answers419
viewsA: Write access log to ASP NET MVC application
I will post an answer in the simplest form I know, which can be used in other languages. The logic is simple. You create a cookie which will be expired by Session, so whenever you close the browser…