Friday, June 22, 2012

Searchable DropDown JQuery

Escaping curly brackets ({) in string format


Recently I was trying to use StringBuilder.AppendFormat to build some javascript, and was hit with an exception when trying to do this:
sb.AppendFormat(“function {0}(args) { return false; }”, someVariable);
The problem is that you can’t have { or } inside an input string for string.Format(). The solution is actually fairly straightforward:
sb.AppendFormat(“function {0}(args) {{ return false; }}”, someVariable);
Instead of using “\” as an escape character, you would use { or } (depending on what you want to escape).

Getting RAW Soap Data from a Web Reference Client running in ASP.net


Make the  following changes in web.cofig to get SOAP(Request/Response) Envelope. It makes trace.log file where all the required information are present



 
   
     
   
 
 
   
     
   
 


 


 
 


Validate INDIAN PAN Number Using Regular expression


Hi
Indian PAN is as follows: AAAAA9999A:
Where First five characters are letters, next 4 numerals, last character letter
One rule there the fourth character is choosen from a list Alphabates as bellows.
C – Company
P – Person
H – HUF(Hindu Undivided Family)
F – Firm
A – Association of Persons (AOP)
T – AOP (Trust)
B – Body of Individuals (BOI)
L – Local Authority
J – Artificial Juridical Person
G – Govt
Hence I will create a regular expression
as bellow
^[\w]{3}(p|P|c|C|h|H|f|F|a|A|t|T|b|B|l|L|j|J|g|G)[\w][\d]{4}[\w]$
Here I have a textbox and a regular expression validator in my aspx page as bellow.


        

$(document).ready vs. $(window).load


Query offers two powerful methods to execute code and attach event handlers: $(document).ready and $(window).load. The document ready event executes already when the HTML-Document is loaded and the DOM is ready, even if all the graphics haven’t loaded yet. If you want to hook up your events for certain elements before the window loads, then $(document).ready is the right place.

1$(document).ready(function() {
2 // executes when HTML-Document is loaded and DOM is ready
3 alert("document is ready");
4});
The window load event executes a bit later when the complete page is fully loaded, including all frames, objects and images. Therefore functions which concern images or other page contents should be placed in the load event for the window or the content tag itself.
1$(window).load(function() {
2 // executes when complete page is fully loaded, including all frames, objects and images
3 alert("window is loaded");
4});