Posts by iuristona • 3,834 points
89 posts
-
2
votes5
answers2197
viewsA: How to create a switch.. case with value ranges?
Use if and else if thus: int dias = 60; if (dias < 30) { System.Console.WriteLine("até 29"); } else if (dias < 60) { System.Console.WriteLine("de 30 até 59"); } else if (dias < 90) {…
-
1
votes2
answers998
viewsA: Method does not work when called
This from here is incorrect, including in the builder of form1 which should contain the call to the (): //form2 private void button1_Click(object sender, EventArgs e) { form1 limpar = new form1();…
-
4
votes3
answers1948
viewsA: Set value of a null or Empty ROW on a gridview
Resolve to change only the value displayed in Gridview? You could do something in the event RowDataBound: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if…
-
4
votes2
answers5079
viewsA: How to count records (SELECT COUNT) in Linq
Basically for you to understand, as long as the list you are referring to is a IQueryable and Entity Framework has not executed any database query EF will attempt to convert its query into an SQL…
-
8
votes1
answer4398
viewsA: How to configure Context not to put table name in plural?
Add to your implementation of DbContext that method: protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();…
-
3
votes2
answers500
viewsQ: Extend a specific jQuery method in ASP.NET MVC jquery.unobtrusive-ajax.js
I’m using the Extensions methods @Ajax.BeginForm() to save the data via AJAX. To avoid running more than one click on the Submit button, which could cause a double Insert in my database, I decided…
-
1
votes2
answers446
viewsA: Jcrop distorting the image at the time of selection
You are defining aspectRatio: 1 which means you want the cutting area to have a fixed ratio, in this case a perfect square, while the selection you set is not a square setSelect: [0, 0, 140, 360].…
-
1
votes3
answers1092
viewsA: Webservice REST does not return XML in IIS 8.0
Apparently your WCF runs and error occurs in Runtime. The first step is to try to change the error message to something more specific and thus be able to locate the problem. Make sure you have debug…
-
6
votes3
answers844
viewsA: Comparison of >= and <= with strings
I have a project here with a similar problem. I use integers to store a year and month representation in format YYYYMM no problem. This way an integer simulating a more recent date will always be…
-
2
votes1
answer1871
viewsA: I am unable to make the value of a property selected using the Razor Helper Dropdownlistfor
I can’t explain why this happened (some bug in MVC) but the name of the field in ViewBag is conflicting with your Model This passage for example: ViewBag.Sexo = new SelectList(SexoList, "Id",…
-
3
votes2
answers1169
viewsA: Save form data in session
When you’re using FormsAuthentication you will be able to recover the logged in user in this way: string username = ""; if (HttpContext.Current.User.Identity.IsAuthenticated) { username =…
-
2
votes2
answers1555
viewsA: Calling action with AJAX, but does not return Alert to view
Although you are calling the method by AJAX, there is no processing that receives the return of your redirect. If the purpose of this action is just to check if the ticket already exists, I suggest…
-
4
votes3
answers4012
viewsA: Confirmation of closing the form
When arriving at the event FormClosing the Form will be closed, except if we set true the property Cancel of the event. private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if…
-
4
votes3
answers1601
viewsA: Breadcrumb algorithm in ASP.NET MVC
I’ll paste a case I created for the assembly of a menu as draft. I’ve declared an auxiliary type: public class MenuItem { public string Text { get; set; } public string Action { get; set; } public…
-
4
votes1
answer264
viewsA: Specific application of attribute [Childactiononly]
I removed from the documentation this passage here: Any method marked with ChildActionOnlyAttribute might be called only through Action or RenderAction HTML Extensions methods. That is, if you have…
-
0
votes3
answers380
viewsA: What is the importance of certification?
In addition to what has already been said, that in large companies, which need to evaluate hundreds of resumes and the certificate is used as a cutoff criterion (accurate or not), I imagine that in…
-
3
votes1
answer737
viewsQ: Loop asynchronous calls and process data at the end of all runs
I have a method of web service which receives the IP of a server as a parameter and returns a DataSet. Several servers must be consulted by this web service, Um List<string> contains the list…
-
1
votes3
answers403
viewsA: Log reading to infer counter
If you are using SQL Server 2012 you should use a sequence. The value must be recovered at the time the form is loaded. If your bank is not SQL Server 2012, an option to simulate a sequence is in…
-
1
votes4
answers1531
viewsA: List all Roles in Checkbox and mark the roles that the User has
You have the existing roles on ViewBag.Roles, correct? Then your foreach should look like this: @foreach (var role in ViewBag.Roles) { <label style="display: block"> <input type="checkbox"…
-
19
votes5
answers2194
viewsA: Exceptions consume a lot of processing. Truth or legend?
This subject is complex, but to demonstrate which way I prefer to go, follows an excerpt from the source code of Entityframework: public DbRawSqlQuery<TElement> SqlQuery<TElement>(string…
-
0
votes2
answers921
viewsA: Text input box on the right
Try the following: <input type="text" onkeyup="ltr(this)" /> function ltr (el) { if (el.setSelectionRange) { el.setSelectionRange(0,0); } }
-
1
votes3
answers2054
viewsA: Protect the connection string in a . NET Winforms application?
I found that older SQL versions, prior to 2005 (specifically 2000) do not work with the parameter encrypt=yes in the connection string (Connection string). I tried on another more recent server and…
-
0
votes2
answers1075
viewsA: How to remove file from TFS Team System source control but not remove it from the project
I know a way that I wouldn’t say the most elegant, but it works... When you include a file in your project (it can be dragged and dropped into the folder in Solution Explorer) it will be marked with…
team-foundation-serveranswered iuristona 3,834 -
4
votes1
answer741
viewsA: Copying one Datepicker to another and incrementing one year (jQuery UI)
Your code works, apparently the problem is with language format, your parse converts into format dd/mm/yy while datepicker displays in format mm/dd/yy. See an example on Jsfiddle Search for the…
-
2
votes5
answers62952
viewsA: How to remove edge of input and textarea from all browsers when clicked?
I believe you’re wearing ASP.NET MVC 5 using Twitter Bootstrap, then you could add this CSS to your Site.css file .form-control:focus { border-color: #cccccc; outline: 0; -webkit-box-shadow: none;…
-
18
votes6
answers42802
viewsA: What is the difference between . on("click", Function() {}) and . click(Function() {})?
According to the documentation $('selector').click(); is just a shortcut to $('seletor').on('click', function() { }); But there is an interesting option of the . on method:…
-
3
votes1
answer2918
viewsA: How to restrict certain file extensions and save to database?
For the browser to list only image files you can do this: <input type="file" name="file" accept="image/jpg, image/png"> However, you will also need to perform a validation in Controller,…
-
0
votes1
answer150
viewsA: Make "Publish" and set prerequisites to run application
Try accessing project properties and in the tab Publish click on Application Files... so in this dialog box mark the missing components files with the option Include. Save your project and make new…
-
4
votes1
answer987
views -
3
votes3
answers2054
viewsQ: Protect the connection string in a . NET Winforms application?
I have an app .NET Windows Forms connecting to a server SQL Server directly, without the use of an intermediate layer as a Webservice or Webapi, through SqlConnection. This application is installed…
-
0
votes4
answers298
viewsA: How to implement an Objectset wrapper that works with Linqtoentities?
I get the impression that your subquery is not being deferred, and therefore it tries to run along with the main query, which could be causing the error. Try to change your code this way:…
-
5
votes4
answers6633
viewsA: How to make the browser "Back" button work on an AJAX site?
Although I don’t know enough to delve into the subject, there is this library history js. which provides several methods to manipulate browser history that works with both Html5 and html4. Code…
-
3
votes2
answers984
viewsA: How to make jQuery Chosen disregard accentuation at the time of the search?
I suggest you use the Select2 which has the same purpose, with very similar layout, which already does what you want, and even provides an option for you to programmatically change the search code.…
-
5
votes3
answers1774
viewsA: Update generating duplicate key error
Check the Id of the child objects, this is probably the problem. You will need to include a Hidden field in the form for each child object id.
-
2
votes8
answers48548
viewsA: How to pass parameters in function calls by reference in Javascript?
Your previous question answers that: $("a").on("click", function() { retornaNada(param); }); I have a question, some jQuery methods expect a function like parameter, but to work they must receive an…
-
2
votes3
answers1664
viewsA: How to use a Cookie as an Array in Javascript?
A good practice is to use JSON. You can convert your object to string with: JSON.stringify(Foo); Before saving the cookie and then recovering with: Foo = JSON.parse(strCookie);…
-
3
votes5
answers16498
viewsA: How can we not apply opacity to a child element?
It is not possible, the opacity of the children will always be relative to that of the parents. If you are needing to change only the background color, it could instead of opacity. modify the…
-
3
votes7
answers6727
viewsA: In object orientation, why are interfaces useful?
I understand that the question has been answered before, but a very simple case is you imagine a method to send an alert when a task should be executed. We create an interface: (simple for demo)…
-
5
votes3
answers12047
viewsA: Why doesn’t C# allow multiple inheritances?
As the question has already been answered, I leave here an example for didactic purposes of how to implement multiple inheritance with C interfaces#. Let’s look at the scenario. public class Nadador…