Showing posts from January 15, 2012

String.Contains Case Sensitive

String.Contains Case Sensitive Case Sensitive String.Contain String.Contains vs IndexOf .Net I encountered an issue with string contains couple of days ago... well, the fact is - it has no StringComparison for culture and Case Sensitivity. I found a better way to do this, and I just wanted to share in a short post:         string bookTitle = "The Old Man and the Sea";         if (bookTitle.IndexOf("the old man") > -1)         {             // this is case sensitive         }         if (bookTitle.IndexOf("the old man", StringComparison.OrdinalIgnoreCase) > -1)         {             // this is ignore case         } There are some more options in the StringComparison , but I'll leave it to you to play with Good day, Elad Shalom, CTO at

Ajax For Dummies in Asp.Net

Ajax for Dummies with Asp.Net.  Ajax for Dummies with JQuery. .Net WebMethods Couple of weeks ago a friend of mine went to a job interview for a junior developer position.  After the interview he came back and complained about his Ajax skills. Well, Noam, this is for you: First open a new ASP.Net web application (or website, doesn't really matter). Make sure you have JQuery in your website. Create a new ASPX page.  lets call it, WebMethods.aspx At the top of the page add "using System.Web.Services;" Create a method called "AjaxForDummies()" and place a "[WebMethod]" attribute for it. This method will not accept parameters but will return a string to the server. Create another method called "AjaxForDummies2(string name, string sDate) " this method will accept 2 parameters and returns a string to the server. The JavaScript code is actually very simple: At the HTML part of the page place a simple code: Pay Attention: 1.