<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-22121232</atom:id><lastBuildDate>Mon, 28 May 2012 00:48:22 +0000</lastBuildDate><category>DESIGN PATTERN</category><category>AJAX</category><category>LINQ</category><category>Update Panel</category><category>TDD</category><category>Internet</category><category>DEV TOOL</category><category>Umbraco</category><category>Unit Testing</category><category>Javascript</category><category>Entity Framework</category><category>.NET</category><title>Kurniawan Kurniawan Blogs</title><description>Live for a mission</description><link>http://kkurni.blogspot.com/</link><managingEditor>noreply@blogger.com (Kurniawan)</managingEditor><generator>Blogger</generator><openSearch:totalResults>44</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/KurniawanBlogs" /><feedburner:info uri="kurniawanblogs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><itunes:explicit>no</itunes:explicit><itunes:subtitle>Live for a mission</itunes:subtitle><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-2074084007918499807</guid><pubDate>Mon, 10 Oct 2011 03:48:00 +0000</pubDate><atom:updated>2011-10-10T14:48:38.022+11:00</atom:updated><title>addEventListener vs attachEvent vs jquery bind</title><description>Unfortunately IE is not friendly to this idea (addEventListener) and decide to throw a javascript error.&lt;br /&gt;&lt;br /&gt;After dig around, I found that we need to use AttachEvent insteead of AddEventListener to support IE.&lt;br /&gt;&lt;br /&gt;Here are some of the reference&lt;br /&gt;https://developer.mozilla.org/en/DOM/element.addEventListener&lt;br /&gt;http://msdn.microsoft.com/en-us/library/ms536343(VS.85).aspx&lt;br /&gt;&lt;br /&gt;as suggested solution, I did a fix in couple javascript code to fix this issue.&lt;br /&gt;&lt;br /&gt;if (el.addEventListener){&lt;br /&gt;el.addEventListener(‘click’, functionText, false);&lt;br /&gt;} else if (el.attachEvent){&lt;br /&gt;el.attachEvent(‘onclick’, functionText);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;why not using Jquery Bind ?&lt;br /&gt;and here is better solution if you use Event capture in addEventListener&lt;br /&gt;Unfortunately, Event capturing is not supported by jQuery, as event capturing is not supported by IE, which jQuery supports.&lt;br /&gt;&lt;br /&gt;if (el.addEventListener){&lt;br /&gt;   el.addEventListener(‘click’, functionText&lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-2074084007918499807?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/cfKr1unuxzk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/cfKr1unuxzk/addeventlistener-vs-attachevent-vs.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/10/addeventlistener-vs-attachevent-vs.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-126412493432174685</guid><pubDate>Fri, 05 Aug 2011 09:01:00 +0000</pubDate><atom:updated>2011-08-05T19:01:57.854+10:00</atom:updated><title>TFS Unshelve to different branch</title><description>TFS Unshelve to different branch&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example (Trunk -&gt; Branch)&lt;br /&gt;&lt;br /&gt;Prerequisites :&lt;br /&gt;Download and install the latest TFS Power toolshttp://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f&lt;br /&gt;&lt;br /&gt;Steps :&lt;br /&gt;&lt;br /&gt;1. Go to Console (cmd.exe)&lt;br /&gt;&lt;br /&gt;2. Go to your target folder. otherwise you will get this error “unable to determine the workspace”&lt;br /&gt;&lt;br /&gt;cd D:\Source\Branch1&lt;br /&gt;&lt;br /&gt;3. execute tfpt.exe&lt;br /&gt;&lt;br /&gt;tfpt unshelve ShelveName1 /migrate /source:$/Project/Trunk /target:$/Project/Branches/Branch1”&lt;br /&gt;&lt;br /&gt;—&lt;br /&gt;&lt;br /&gt;Here is the syntax : tfpt unshelve “MySampleShelveName” /migrate /source:”$/MyTeamProject/TheOrigionalBranch” /target:”TheDestinationBranch”&lt;br /&gt;&lt;br /&gt;4. Confirm to unshelve&lt;br /&gt;&lt;br /&gt;5. Merge&lt;br /&gt;&lt;br /&gt;6. Check your pending changes (DONE)&lt;br /&gt;&lt;br /&gt;——&lt;br /&gt;&lt;br /&gt;Catches&lt;br /&gt;&lt;br /&gt;If you get the error =&gt; “unable to determine the workspace”&lt;br /&gt;&lt;br /&gt;NOTE: Take the latest from your source control and “cd” to a local path that is mapped to thetarget workspace. Also ensure that the current working directory is mapped, you can run “tf workspace” and see if the target folders are mapped.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-126412493432174685?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/JXr4VGTLMYo" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/JXr4VGTLMYo/tfs-unshelve-to-different-branch.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/08/tfs-unshelve-to-different-branch.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-6799846391216187395</guid><pubDate>Mon, 25 Jul 2011 06:19:00 +0000</pubDate><atom:updated>2011-07-25T16:19:19.900+10:00</atom:updated><title>implement ssl custom attribute in MVC</title><description>Example of how to implement your SSL Custom Attribute in MVC&lt;br /&gt;&lt;br /&gt;·         If it is login, then we must force it into secure otherwise we need to force to unsecure.&lt;br /&gt;&lt;br /&gt;·         Ideally in LoginController, we can use this attribute [CustomRequireHttps] which will force to use SSL&lt;br /&gt;&lt;br /&gt;·         For other controller, we can use this attribute [CustomRequireHttps(false)] which will force not to use SSL&lt;br /&gt;&lt;br /&gt;·         For other controller which always not required SSL we can create other attribute to force not to use SSL [CustomNotRequireHttps]&lt;br /&gt; &lt;br /&gt;    /// &lt;summary&gt;Represents an attribute that forces an unsecured HTTP request to be re-sent over HTTPS.&lt;/summary&gt;&lt;br /&gt;    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]&lt;br /&gt;    public class CustomRequireHttpsAttribute : FilterAttribute, IAuthorizationFilter&lt;br /&gt;    {&lt;br /&gt;        private bool _ForceOnLoggedIn = false;&lt;br /&gt; &lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Constructor&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="forceOnLoggedIn"&gt;&lt;/param&gt;&lt;br /&gt;        public CustomRequireHttpsAttribute() : this(false);&lt;br /&gt; &lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// Constructor&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="forceOnLoggedIn"&gt;&lt;/param&gt;&lt;br /&gt;        public CustomRequireHttpsAttribute(bool forceOnLoggedIn)&lt;br /&gt;        {&lt;br /&gt;            this._ForceOnLoggedIn = forceOnLoggedIn;&lt;br /&gt;        }&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;        /// &lt;summary&gt;Handles unsecured HTTP requests that are sent to the action method.&lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="filterContext"&gt;An object that encapsulates information that is required in order to use the &lt;see cref="T:System.Web.Mvc.RequireHttpsAttribute" /&gt; attribute.&lt;/param&gt;&lt;br /&gt;        /// &lt;exception cref="T:System.InvalidOperationException"&gt;The HTTP request contains an invalid transfer method override. All GET requests are considered invalid.&lt;/exception&gt;&lt;br /&gt;        protected virtual void ForceSecure(AuthorizationContext filterContext)&lt;br /&gt;        {&lt;br /&gt;            if (!filterContext.HttpContext.Request.IsSecureConnection)&lt;br /&gt;            {&lt;br /&gt;                if (!string.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))&lt;br /&gt;                {&lt;br /&gt;                    //throw error if the request is not get&lt;br /&gt;                    throw new InvalidOperationException("SeekRequireHttpsAttribute_MustUseSsl");&lt;br /&gt;                }&lt;br /&gt; &lt;br /&gt;                string url = "https://" + filterContext.HttpContext.Request.Url.Host + filterContext.HttpContext.Request.RawUrl;&lt;br /&gt;                filterContext.Result = new RedirectResult(url);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt; &lt;br /&gt;        /// &lt;summary&gt;Force unsecure page only deal with get method&lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="filterContext"&gt;An object that encapsulates information that is required in order to use the &lt;see cref="T:System.Web.Mvc.RequireHttpsAttribute" /&gt; attribute.&lt;/param&gt;&lt;br /&gt;        /// &lt;exception cref="T:System.InvalidOperationException"&gt;The HTTP request contains an invalid transfer method override. All GET requests are considered invalid.&lt;/exception&gt;&lt;br /&gt;        protected virtual void ForceUnsecure(AuthorizationContext filterContext)&lt;br /&gt;        {&lt;br /&gt;            if (filterContext.HttpContext.Request.IsSecureConnection)&lt;br /&gt;            {&lt;br /&gt;                //if it is secure page&lt;br /&gt;                if (string.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))&lt;br /&gt;                {&lt;br /&gt;                    //only deal with get method&lt;br /&gt;                    string url = "https://" + filterContext.HttpContext.Request.Url.Host + filterContext.HttpContext.Request.RawUrl;&lt;br /&gt;                    filterContext.Result = new RedirectResult(url);&lt;br /&gt;                }               &lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;        /// &lt;summary&gt;Determines whether a request is secured (HTTPS) and, if it is not, calls the &lt;see cref="M:System.Web.Mvc.RequireHttpsAttribute.HandleNonHttpsRequest(System.Web.Mvc.AuthorizationContext)" /&gt; method.&lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="filterContext"&gt;An object that encapsulates information that is required in order to use the &lt;see cref="T:System.Web.Mvc.RequireHttpsAttribute" /&gt; attribute.&lt;/param&gt;&lt;br /&gt;        /// &lt;exception cref="T:System.ArgumentNullException"&gt;The &lt;paramref name="filterContext" /&gt; parameter is null.&lt;/exception&gt;&lt;br /&gt;        public virtual void OnAuthorization(AuthorizationContext filterContext)&lt;br /&gt;        {&lt;br /&gt;            if (filterContext == null)&lt;br /&gt;            {&lt;br /&gt;                throw new ArgumentNullException("filterContext");&lt;br /&gt;            }&lt;br /&gt; &lt;br /&gt;            if (_ForceOnLoggedIn == false)&lt;br /&gt;            {&lt;br /&gt;                this.ForceSecure(filterContext);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                //check if Login&lt;br /&gt;                if (filterContext.RequestContext.HttpContext.User.Identity.IsAuthenticated)&lt;br /&gt;                {&lt;br /&gt;                    //if login then need to force secure page&lt;br /&gt;                    this.ForceSecure(filterContext);&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    //if not login then need to force to unsecure page&lt;br /&gt;                    this.ForceUnsecure(filterContext);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt; &lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-6799846391216187395?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/IBW91a-AtGw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/IBW91a-AtGw/implement-ssl-custom-attribute-in-mvc.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/07/implement-ssl-custom-attribute-in-mvc.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-3433636763837964921</guid><pubDate>Thu, 21 Jul 2011 08:43:00 +0000</pubDate><atom:updated>2011-07-21T18:43:03.249+10:00</atom:updated><title>anti frogery for mvc and ajax</title><description>I just found very good solution to protect our sites from Anti Frogery for ASP.NET MVC and AJAX.&lt;br /&gt;&lt;br /&gt;This solution can be easily applied to class controller and ajax.&lt;br /&gt;&lt;br /&gt;Here is the article.&lt;br /&gt;&lt;br /&gt;http://weblogs.asp.net/dixin/archive/2010/05/22/anti-forgery-request-recipes-for-asp-net-mvc-and-ajax.aspx&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-3433636763837964921?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/q1a6kaqfpts" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/q1a6kaqfpts/anti-frogery-for-mvc-and-ajax.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/07/anti-frogery-for-mvc-and-ajax.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-2771166351847610914</guid><pubDate>Wed, 20 Jul 2011 08:17:00 +0000</pubDate><atom:updated>2011-07-20T18:17:09.569+10:00</atom:updated><title>Javascript XSS Attack</title><description>Reminder for javascript XSS Attack&lt;br /&gt;&lt;br /&gt;For example&lt;br /&gt;&lt;br /&gt; var name = "&lt;%= UserInput %&gt;";&lt;br /&gt;&lt;br /&gt;If there is a post which submit the username with &lt;br /&gt;" ;alert(document.cookie);//&lt;br /&gt;&lt;br /&gt;then this will trigger XSS Attack.&lt;br /&gt;&lt;br /&gt;There is simple fix which I have added inside String Extension (available for Support R5)&lt;br /&gt; var currentUsername = "&lt;%= Encoder.JavascriptEncode(UserInput)  %&gt;";&lt;br /&gt;&lt;br /&gt;Hopefully this post can be a reminder for all of us to protect our site.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-2771166351847610914?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/mgSX6KJ7LeE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/mgSX6KJ7LeE/javascript-xss-attack.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/07/javascript-xss-attack.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-2710136307480632351</guid><pubDate>Mon, 11 Jul 2011 05:45:00 +0000</pubDate><atom:updated>2011-07-11T15:45:32.621+10:00</atom:updated><title>Client validation in FF</title><description>Recently, I have to fix a bug where client validation doesn’t work in FF.&lt;br /&gt;&lt;br /&gt;Finally, i notice that the problem exist in web.config which tells to force xhtmlConformance mode=”legacy”&lt;br /&gt;&lt;br /&gt;   1: &lt;xhtmlConformance mode="Legacy"/&gt;&lt;br /&gt;This will render the validation attribute &lt;br /&gt;&lt;br /&gt;   1:  &lt;br /&gt;   2:    &lt;span &lt;br /&gt;   3:    controltovalidate="text1" &lt;br /&gt;   4:    id="required1" &lt;br /&gt;   5:    evaluationfunction="RequiredFieldValidatorEvaluateIsValid" &lt;br /&gt;   6:    validationgroup="grp1"&lt;br /&gt;   7:    initialvalue="" &lt;br /&gt;   8:    style="color:Red;visibility:hidden;"&gt;required&lt;/span&gt;&lt;br /&gt;Instead of this&lt;br /&gt;&lt;br /&gt;   1: &lt;span id="required1" &lt;br /&gt;   2: yle="color:Red;visibility:hidden;"&gt;required&lt;/span&gt;&lt;br /&gt;   3:  &lt;br /&gt;   4:  &lt;script type="text/javascript"&gt;&lt;br /&gt;   5:  &lt;!--&lt;br /&gt;   6:  var required1 = document.all ? document.all["required1"] : &lt;br /&gt;   7: cument.getElementById("required1");&lt;br /&gt;   8:  required1.controltovalidate = "text1";&lt;br /&gt;   9:  required1.errormessage = "required";&lt;br /&gt;  10:  required1.validationGroup = "grp1";&lt;br /&gt;  11:  required1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";&lt;br /&gt;  12:  required1.initialvalue = "";&lt;br /&gt;  13:  // --&gt;&lt;br /&gt;  14:  &lt;/script&gt;&lt;br /&gt;The reason why it doesn’t work is EXPANDO.&lt;br /&gt;&lt;br /&gt;When tracing in the debugger, you can see that the expando properties are&lt;br /&gt;not recognized, though they do exist in the "attributes" collection.&lt;br /&gt;Expando attributes are fine in Firefox, but cannot be accessed as if they&lt;br /&gt;are a part of the DOM as IE allows. Any attribute that is not part of the&lt;br /&gt;DOM is only accessible via obj.getAttribute('x') or obj.attributes['x'].value.&lt;br /&gt;&lt;br /&gt;The ASP.NET 2.0 client script library needs to be updated to avoid the&lt;br /&gt;DOM-like property access to expando attributes. Instead, use getAttribute().&lt;br /&gt;Some links re expandos:&lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/referen&lt;br /&gt;ce/properties/expando.asp&lt;br /&gt;http://www.xulplanet.com/ndeakin/archive/2004/9/12/&lt;br /&gt;http://www.howtocreate.co.uk/tutorials/javascript/dombasics&lt;br /&gt;Also, all HTML attributes are supposed to be caseless, so &lt;span age="23" /&gt;&lt;br /&gt;and &lt;span Age="23" /&gt; are identical. However IE 6 treats them as two&lt;br /&gt;different attributes, so be sure that all references are in lowercase!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-2710136307480632351?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/VGLRUZmA1AU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/VGLRUZmA1AU/client-validation-in-ff.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/07/client-validation-in-ff.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-8769099829593054363</guid><pubDate>Wed, 22 Jun 2011 10:16:00 +0000</pubDate><atom:updated>2011-06-22T20:16:51.275+10:00</atom:updated><title>EJB 3.1 Cookbook</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Recently I read new release book titled “EJB 3.1 Cookbook” by Richard M.Reese. &lt;a title="http://www.packtpub.com/ejb-3-1-cookbook/book" href="http://www.packtpub.com/ejb-3-1-cookbook/book"&gt;http://www.packtpub.com/ejb-3-1-cookbook/book&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If you wonder why I read this book instead of .NET book, Please find it on this post. =D&lt;/p&gt; &lt;p&gt;This book talks about building real world EJB solutions with a collection of simple but incredibly effective recipes and here a list of the overview of this book.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Build real world solutions and address many common tasks found in the development of EJB applications  &lt;li&gt;Manage transactions and secure your EJB applications  &lt;li&gt;Master EJB Web Services  &lt;li&gt;Part of Packt's Cookbook series: Comprehensive step-by-step recipes illustrate the use of Java to incorporate EJB 3.1 technologies &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Enterprise Java Beans enable rapid and simplified development of secure and portable applications based on Java technology.Creating and using EJBs can be challenging and rewarding. Among the challenges are learning the EJB technology itself, learning how to use the development environment you have chosen for EJB development, and the testing of the EJBs. &lt;p&gt;This EJB 3.1 Cookbook addresses all these challenges and covers new 3.1 features, along with explanations of useful retained features from earlier versions. It brings the reader quickly up to speed on how to use EJB 3.1 techniques through the use of step-by-step examples without the need to use multiple incompatible resources. The coverage is concise and to the point, and is organized to allow you to quickly find and learn those features of interest to you. &lt;p&gt;The book starts with coverage of EJB clients. The reader can choose the chapters and recipes which best address his or her specific needs. The newer EJB technologies presented include singleton beans which support application wide needs and interceptors to permit processing before and after a target method is invoked. Asynchronous invocation of methods and enhancements to the timer service are also covered.  &lt;p&gt;The EJB 3.1 CookBook is a very straightforward and rewarding source of techniques supporting Java EE applications. &lt;p&gt;&lt;b&gt;What you will learn from this book :&lt;/b&gt; &lt;ul&gt; &lt;li&gt;Create and use the different types of EJBs along with the use of the optional session bean business interface  &lt;li&gt;Create a singleton session bean for application-wide use  &lt;li&gt;Use declarative and programmatic techniques for security, timer services, and transaction processing  &lt;li&gt;Use asynchronous session beans to complement message driven beans  &lt;li&gt;Support aspect oriented features such as logging and data validation using interceptors  &lt;li&gt;Use EJBs in support of message based applications  &lt;li&gt;Master the use of deployment descriptors and improved packaging options  &lt;li&gt;Use EJBs outside of the Java EE environment using the embeddable container &lt;/li&gt;&lt;/ul&gt;&lt;br&gt;&lt;b&gt;Approach&lt;/b&gt; &lt;p&gt;Each recipe comprises step-by-step instructions followed by an analysis of what was done in each task and other useful information. The book is designed so that you can read it chapter by chapter, or look at the list of recipes and refer to them in no particular order. It is packed with useful screenshots to make your learning even easier. &lt;p&gt;&lt;b&gt;Who this book is written for&lt;/b&gt; &lt;p&gt;The book is aimed at Java EE and EJB developers and programmers. Readers should be familiar with the use of servlets in the construction of a web application. A working knowledge of XML is also desirable.&lt;br&gt;&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;After I read this book I am really grateful to take .NET as my favourite framework. Because since in I was uni when I was first learned EJB, The version was not different. There is slightly changes and less improvement. However overall this book is really great. Easy to read and great coverage of knowledge.   &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-8769099829593054363?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/KGr94gIrzds" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/KGr94gIrzds/ejb-31-cookbook.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/06/ejb-31-cookbook.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-6340523557104593529</guid><pubDate>Thu, 09 Jun 2011 01:58:00 +0000</pubDate><atom:updated>2011-06-09T12:29:29.239+10:00</atom:updated><title>Html5 histoty API and CSS3 transitions</title><description>Check out new HTML5 History API allows us to manage the URL changes while CSS3 transitions handle the sliding. Permalinks are always maintained, your back button works as expected, and it's much faster than waiting for a full page load.  &lt;br /&gt;  &lt;br /&gt;Basically we intercept your click, call pushState() to change the browser's URL, load in data with Ajax, then slide over to it.  &lt;br /&gt;  &lt;br /&gt;$('#slider a').click(function() {  &lt;br /&gt;history.pushState({ path: this.path }, '', this.href)  &lt;br /&gt;$.get(this.href, function(data) {  &lt;br /&gt;$('#slider').slideTo(data)   &lt;br /&gt;})  &lt;br /&gt;return false   &lt;br /&gt;})  &lt;br /&gt;view rawslide.jsThis Gist brought to you by GitHub.  &lt;br /&gt;When you hit the back button, an onpopstate handler is fired after the URL changes, making it easy to send you &amp;quot;back&amp;quot;.  &lt;br /&gt;  &lt;br /&gt;$(window).bind('popstate', function() {  &lt;br /&gt;$('#slider').slideTo(location.pathname)  &lt;br /&gt;})  &lt;br /&gt;view rawunslide.jsThis Gist brought to you by GitHub.  &lt;br /&gt;  &lt;div class="blogger-post-footer"&gt;&amp;#160;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&amp;#160;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;Here is the best book for me to read about HTML 5 &lt;a title="http://diveintohtml5.org/" href="http://diveintohtml5.org/"&gt;http://diveintohtml5.org/&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-6340523557104593529?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/2JwXHyVD-DU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/2JwXHyVD-DU/html5-histoty-api-and-css3-transitions.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/06/html5-histoty-api-and-css3-transitions.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-7892948352243468421</guid><pubDate>Wed, 08 Jun 2011 06:10:00 +0000</pubDate><atom:updated>2011-06-08T16:10:02.906+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Unit Testing</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>TDD Practices</title><description>&lt;p&gt;Just read couple good article which I think required for anyone who writing unit testing.&lt;/p&gt;  &lt;p&gt;Here couple of screen shot from those article&lt;/p&gt;  &lt;h1&gt;Concept&lt;/h1&gt;  &lt;p&gt;&lt;strong&gt;Finding bugs&lt;/strong&gt; (things that don’t work as you want them to)&amp;#160; &lt;br /&gt;=&amp;gt; &lt;strong&gt;Manual testing&lt;/strong&gt; (sometimes also automated integration tests) &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Detecting regressions&lt;/strong&gt; (things that used to work but have unexpectedly stopped working)     &lt;br /&gt;&lt;strong&gt;=&amp;gt; Automated integration tests&lt;/strong&gt; (sometimes also manual testing, though time-consuming) &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Designing&lt;/strong&gt; &lt;strong&gt;software components&lt;/strong&gt; robustly     &lt;br /&gt;&lt;strong&gt;=&amp;gt;Unit testing&lt;/strong&gt; (within the TDD process) &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Good unit tests vs bad ones&lt;/h1&gt;  &lt;p&gt;TDD helps you to deliver software components that individually behave according to your design. &lt;b&gt;A suite of good unit tests is immensely valuable&lt;/b&gt;: it documents your design, and makes it easier to refactor and expand your code while retaining a clear overview of each component’s behaviour. However, &lt;b&gt;a suite of &lt;i&gt;bad&lt;/i&gt; unit tests is immensely painful&lt;/b&gt;: it doesn’t prove anything clearly, and can severely inhibit your ability to refactor or alter your code in any way. &lt;/p&gt;  &lt;p&gt;Where do your tests sit on the following scale?&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.codeville.net/wp-content/uploads/2009/08/image.png"&gt;&lt;img title="image" border="0" alt="image" src="http://blog.codeville.net/wp-content/uploads/2009/08/image-thumb1.png" width="611" height="160" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Unit tests created through the TDD process naturally sit at the extreme left of this scale. They contain a lot of knowledge about the behaviour of a single unit of code. If that unit’s behaviour changes, so must its unit tests, and vice-versa. But they don’t contain &lt;i&gt;any&lt;/i&gt; knowledge or assumptions about other parts of your codebase, so &lt;b&gt;changes to other parts of your codebase don’t make them start failing &lt;/b&gt;(and if yours do, that shows they aren’t true unit tests). Therefore they’re cheap to maintain, and as a development technique, TDD scales up to any size of project.&lt;/p&gt;  &lt;p&gt;At the other end of the scale, integration tests contain no knowledge about how your codebase is broken down into units, but instead make statements about how the whole system behaves towards an external user. They’re reasonably cheap to maintain (because no matter how you restructure the internal workings of your system, it needn’t affect an external observer) and they prove a great deal about what features are actually working today.&lt;/p&gt;  &lt;p&gt;Anywhere in between, it’s unclear what assumptions you’re making and what you’re trying to prove. Refactoring might break these tests, or it might not, regardless of whether the end-user experience still works. Changing the external services you use (such as upgrading your database) might break these tests, or it might not, regardless of whether the end-user experience still works. Any small change to the internal workings of a single unit might force you to fix hundreds of seemingly unrelated hybrid tests, so they tend to consume a huge amount of maintenance time – sometimes in the region of 10 times longer than you spend maintaining the actual application code. And it’s frustrating because you know that adding more preconditions to make these hybrid tests go green doesn’t truly prove anything.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Tips for writing great unit tests&lt;/h1&gt;  &lt;p&gt;Enough vague discussion – time for some practical advice. Here’s some guidance for writing unit tests that sit snugly at &lt;i&gt;Sweet Spot A&lt;/i&gt; on the preceding scale, and are virtuous in other ways too.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Make each test orthogonal (i.e., independent) to all the others        &lt;br /&gt;&lt;/b&gt;Any given behaviour should be specified in one &lt;i&gt;and only one&lt;/i&gt; test. Otherwise if you later change that behaviour, you’ll have to change multiple tests. The corollaries of this rule include:       &lt;ul&gt;       &lt;li&gt;&lt;b&gt;Don’t make unnecessary assertions&lt;/b&gt;          &lt;br /&gt;Which specific behaviour are you testing? It’s counterproductive to Assert() anything that’s also asserted by another test: it just increases the frequency of pointless failures without improving unit test coverage one bit. This also applies to unnecessary Verify() calls – if it isn’t the core behaviour under test, then stop making observations about it! Sometimes, TDD folks express this by saying “&lt;em&gt;have only one logical assertion per test&lt;/em&gt;”.           &lt;br /&gt;Remember, unit tests are a design specification of how a certain behaviour should work, not a list of observations of &lt;em&gt;everything &lt;/em&gt;the code happens to do. &lt;/li&gt;        &lt;li&gt;&lt;b&gt;Test only one code unit at a time            &lt;br /&gt;&lt;/b&gt;Your architecture &lt;i&gt;must&lt;/i&gt; support testing units (i.e., classes or very small groups of classes) independently, not all chained together. Otherwise, you have lots of overlap between tests, so changes to one unit can cascade outwards and cause failures everywhere.           &lt;br /&gt;If you can’t do this, then your architecture is limiting your work’s quality – consider using Inversion of Control. &lt;/li&gt;        &lt;li&gt;&lt;b&gt;Mock out all external services and state            &lt;br /&gt;&lt;/b&gt;Otherwise, behaviour in those external services overlaps multiple tests, and state data means that different unit tests can influence each other’s outcome.           &lt;br /&gt;You’ve definitely taken a wrong turn if you have to run your tests in a specific order, or if they only work when your database or network connection is active.           &lt;br /&gt;(By the way, sometimes your architecture might mean your code touches static variables during unit tests. Avoid this if you can, but if you can’t, at least make sure each test resets the relevant statics to a known state before it runs.) &lt;/li&gt;        &lt;li&gt;&lt;b&gt;Avoid unnecessary preconditions            &lt;br /&gt;&lt;/b&gt;Avoid having common setup code that runs at the beginning of lots of unrelated tests. Otherwise, it’s unclear what assumptions each test relies on, and indicates that you’re not testing just a single unit.           &lt;br /&gt;An exception: Sometimes I find it useful to have a common setup method shared by a &lt;i&gt;very&lt;/i&gt; &lt;i&gt;small&lt;/i&gt; number of unit tests (a handful at the most) but only if &lt;i&gt;all&lt;/i&gt; those tests require &lt;i&gt;all&lt;/i&gt; of those preconditions. This is related to the &lt;i&gt;context-specification&lt;/i&gt; unit testing pattern, but still risks getting unmaintainable if you try to reuse the same setup code for a wide range of tests. &lt;/li&gt;     &lt;/ul&gt;      &lt;p&gt;(By the way, I wouldn’t count pushing multiple data points through the same test (e.g., using NUnit’s [TestCase] API) as violating this orthogonality rule. The test runner may display multiple failures if something changes, but it’s still only one test method to maintain, so that’s fine.) &lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Don’t unit-test configuration settings        &lt;br /&gt;&lt;/b&gt;By definition, your configuration settings aren’t part of any unit of code (that’s why you extracted the setting out of your unit’s code). Even if you could write a unit test that inspects your configuration, it merely forces you to specify the same configuration in an additional redundant location. Congratulations: it proves that you can copy and paste!       &lt;p&gt;Personally I regard the use of things like filters in ASP.NET MVC as being configuration. Filters like [Authorize] or [RequiresSsl] are configuration options baked into the code. By all means write an integration test for the externally-observable behaviour, but it’s meaningless to try unit testing for the filter attribute’s presence in your source code – it just proves that you can copy and paste again. That doesn’t help you to design anything, and it won’t ever detect any defects. &lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Name your unit tests clearly and consistently        &lt;br /&gt;&lt;/b&gt;If you’re testing how ProductController’s Purchase action behaves when stock is zero, then maybe have a test fixture class called PurchasingTests with a unit test called ProductPurchaseAction_IfStockIsZero_RendersOutOfStockView(). This name describes the &lt;b&gt;subject&lt;/b&gt; (ProductController’s Purchase action), the &lt;b&gt;scenario&lt;/b&gt; (stock is zero), and the &lt;b&gt;result&lt;/b&gt; (renders “out of stock” view). I don’t know whether there’s an existing name for this naming pattern, though I know others follow it. How about &lt;b&gt;S/S/R&lt;/b&gt;?&amp;#160; &lt;p&gt;Avoid non-descriptive unit tests names such as Purchase() or OutOfStock(). Maintenance is hard if you don’t know what you’re trying to maintain. &lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-7892948352243468421?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/uL3nk9rutyg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/uL3nk9rutyg/tdd-practices.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/06/tdd-practices.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-4438090045101373400</guid><pubDate>Tue, 24 May 2011 23:25:00 +0000</pubDate><atom:updated>2011-05-25T09:25:56.805+10:00</atom:updated><title>IE9 [Tidy Error] in Umbraco</title><description>&lt;p&gt;In the mean time to solve this problem is to force the compatibility mode in IE9 inside the umbraco folder&lt;/p&gt;  &lt;p&gt;This how you can do this&lt;/p&gt;  &lt;p&gt;Header name : X-UA-Compatible   &lt;br /&gt;Value : IE=8&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_kEiMJawhtH8/Tdw-fM5qyeI/AAAAAAAAAfM/Am9wtuiGym4/s1600-h/image%5B2%5D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_kEiMJawhtH8/Tdw-g8u33FI/AAAAAAAAAfQ/R4eF0KeKaXc/image_thumb.png?imgmax=800" width="244" height="142" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-4438090045101373400?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/jmXc3GGMMIE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/jmXc3GGMMIE/ie9-tidy-error-in-umbraco.html</link><author>noreply@blogger.com (Kurniawan)</author><media:thumbnail url="http://lh3.ggpht.com/_kEiMJawhtH8/Tdw-g8u33FI/AAAAAAAAAfQ/R4eF0KeKaXc/s72-c/image_thumb.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/05/ie9-tidy-error-in-umbraco.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-75898982427019386</guid><pubDate>Tue, 24 May 2011 05:43:00 +0000</pubDate><atom:updated>2011-05-24T15:43:58.806+10:00</atom:updated><title>Google Chrome Autofill for password</title><description>&lt;p&gt;Recently I found an error in my web apps when I ran it to Google Chrome.&lt;/p&gt;  &lt;p&gt;After debugging , It seems Google Chrome do prefill after the page load and trigger the javascript.    &lt;br /&gt;    &lt;br /&gt;So be careful to have this javascript which purposely trigger login button on change on password text box.    &lt;br /&gt;    &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; setupTriggerButton = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; ()&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//for login trigger       &lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//DON'T DO ONCHANGE - only use keypress, because browser (Chrome) can automatically fill and cause postback&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;/*&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;        $(&amp;quot;.txtTriggerButton&amp;quot;).live(&amp;quot;change&amp;quot;, function (e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;            var rel = $(this).attr(&amp;quot;rel&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;            if (rel &amp;amp;&amp;amp; rel != &amp;quot;&amp;quot;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;                $(rel).click();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;        });&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;        */&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//trigger login&lt;/span&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;.txtTriggerButton&amp;quot;&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;keypress&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; rel = $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).attr(&lt;span style="color: #006080"&gt;&amp;quot;rel&amp;quot;&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (rel &amp;amp;&amp;amp; rel != &lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #008000"&gt;//$.log('run from DISABLE DEFAULT BUtton');&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; runFunctionOnEnter(e,&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; ()&lt;br /&gt;                    {&lt;br /&gt;                        $(rel).click();&lt;br /&gt;                    }&lt;br /&gt;                );&lt;br /&gt;            }&lt;br /&gt;        });&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-75898982427019386?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/rMCNu3m4q1o" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/rMCNu3m4q1o/google-chrome-autofill-for-password.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/05/google-chrome-autofill-for-password.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-6943743427442959131</guid><pubDate>Tue, 19 Apr 2011 06:48:00 +0000</pubDate><atom:updated>2011-04-19T16:48:32.597+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">AJAX</category><category domain="http://www.blogger.com/atom/ns#">Update Panel</category><title>ClientIDMode = “Predictable” broke my dropdown list auto partial postback</title><description>&lt;p&gt;In my previous post, I try to upgrade my recent .NET web apps to use recent .NET for capabilities by doing this   &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;pages&lt;/span&gt; &lt;span style="color: #ff0000"&gt;controlRenderingCompatibilityVersion&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;4.0&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;But unfortunately, I find couple of my control inside UPDATE PANEL – does not do Partial Postback anymore. (It is doing FULL postback now)&lt;br /&gt;  &lt;br /&gt;This only happen to a control outside button which I have set as autoPostback = true.&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;After looking around and test which part that I need to put it back, I found &lt;strong&gt;clientIDMode.&lt;br /&gt;    &lt;br /&gt;&lt;/strong&gt;I need to set clientIDMode=“AutoID” because the default value is “Predictable”.&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;pages&lt;/span&gt; &lt;span style="color: #ff0000"&gt;controlRenderingCompatibilityVersion&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;4.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;clientIDMode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Predictable&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The weird things is I try to compare the id and html which generated by both “predictable and “AutoID”. And the result is the &lt;strong&gt;SAME &lt;/strong&gt;but the different is one of them can do partial postback and one of them not.&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;strong&gt;&lt;span style="color: #008000"&gt;&amp;lt;!-- Generated when I set &amp;quot;clientIDMode='Predictable'&amp;quot; --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;select&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ddlPostback&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ContentPlaceHolderDefault_MainContainerPlaceHolder_ucProductDetail_rptVariationChoiceGroup_ddlChoiceGroup_0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;onchange&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;javascript:setTimeout('__doPostBack(\'ctl00$ctl00$ctl00$ContentPlaceHolderDefault$MainContainerPlaceHolder$ucProductDetail$rptVariationChoiceGroup$ctl00$ddlChoiceGroup\',\'\')', 0)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ctl00$ctl00$ctl00$ContentPlaceHolderDefault$MainContainerPlaceHolder$ucProductDetail$rptVariationChoiceGroup$ctl00$ddlChoiceGroup&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Please select&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;selected&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;selected&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Green&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;3&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Yellow&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;4&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Blue&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;5&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Brown&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;select&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;&lt;span style="color: #008000"&gt;&amp;lt;!-- Generated when I set &amp;quot;clientIDMode='AutoID'&amp;quot; --&amp;gt;&lt;/span&gt;    &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;select&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ddlPostback&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ContentPlaceHolderDefault_MainContainerPlaceHolder_ucProductDetail_rptVariationChoiceGroup_ddlChoiceGroup_0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;onchange&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;javascript:setTimeout('__doPostBack(\'ctl00$ctl00$ctl00$ContentPlaceHolderDefault$MainContainerPlaceHolder$ucProductDetail$rptVariationChoiceGroup$ctl00$ddlChoiceGroup\',\'\')', 0)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ctl00$ctl00$ctl00$ContentPlaceHolderDefault$MainContainerPlaceHolder$ucProductDetail$rptVariationChoiceGroup$ctl00$ddlChoiceGroup&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Please select&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;selected&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;selected&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Green&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;3&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Yellow&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;4&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Blue&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;5&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Brown&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;option&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;select&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-6943743427442959131?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/fKZHcjBf6HY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/fKZHcjBf6HY/clientidmode-predictable-broke-my.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/04/clientidmode-predictable-broke-my.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-7302934433858011222</guid><pubDate>Fri, 15 Apr 2011 06:49:00 +0000</pubDate><atom:updated>2011-04-15T16:49:54.007+10:00</atom:updated><title>Grab asp.net 4.0 benefits</title><description>&lt;p&gt;When you upgrade asp.net 2.0/3.5 project using Visual studio.   &lt;br /&gt;VS will automatically add a configuration which prevent you from breaking the results of the projects.&lt;/p&gt;  &lt;p&gt;Here is couple example of the configuration which preserve the behaviour of .net 2.0/3.5&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;pages controlRenderingCompatibilityVersion=&lt;span style="color: #006080"&gt;&amp;quot;3.5&amp;quot;&lt;/span&gt; enableEventValidation=&lt;span style="color: #006080"&gt;&amp;quot;false&amp;quot;&lt;/span&gt; clientIDMode=&lt;span style="color: #006080"&gt;&amp;quot;AutoID&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;strong&gt;ControlRenderingCompatibilityVersion Setting in the Web.config File&lt;/strong&gt;&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;ASP.NET controls have been modified in the .NET Framework version 4 in order to let you specify more precisely how they render markup. In previous versions of the .NET Framework, some controls emitted markup that you had no way to disable. By default, ASP.NET 4 this type of markup is no longer generated.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you use Visual Studio 2010 to upgrade your application from ASP.NET 2.0 or ASP.NET 3.5, the tool automatically adds a setting to the &lt;code&gt;Web.config&lt;/code&gt; file that preserves legacy rendering. However, if you upgrade an application by changing the application pool in IIS to target the .NET Framework 4, ASP.NET uses the new rendering mode by default.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;strong&gt;ClientIDMode Changes&lt;/strong&gt;&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The &lt;strong&gt;ClientIDMode&lt;/strong&gt; setting in ASP.NET 4 lets you specify how ASP.NET generates the &lt;strong&gt;id&lt;/strong&gt; attribute for HTML elements. In previous versions of ASP.NET, the default behavior was equivalent to the &lt;strong&gt;AutoID&lt;/strong&gt; setting of &lt;strong&gt;ClientIDMode&lt;/strong&gt;. However, the default setting is now &lt;strong&gt;Predictable&lt;/strong&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you use Visual Studio 2010 to upgrade your application from ASP.NET 2.0 or ASP.NET 3.5, the tool automatically adds a setting to the &lt;code&gt;Web.config&lt;/code&gt; file that preserves the behavior of earlier versions of the .NET Framework. However, if you upgrade an application by changing the application pool in IIS to target the .NET Framework 4, ASP.NET uses the new mode by default. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;httpRuntime requestValidationMode=&lt;span style="color: #006080"&gt;&amp;quot;2.0&amp;quot;&lt;/span&gt;/&amp;gt;        &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;strong&gt;ASP.NET Request Validation&lt;/strong&gt;&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The request validation feature in ASP.NET provides a certain level of default protection against cross-site scripting (XSS) attacks. In previous versions of ASP.NET, request validation was enabled by default. However, it applied only to ASP.NET pages (&lt;code&gt;.aspx&lt;/code&gt; files and their class files) and only when those pages were executing.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In ASP.NET 4, by default, request validation is enabled for all requests, because it is enabled before the &lt;strong&gt;BeginRequest&lt;/strong&gt; phase of an HTTP request. As a result, request validation applies to requests for all ASP.NET resources, not just .aspx page requests. This includes requests such as Web service calls and custom HTTP handlers. Request validation is also active when custom HTTP modules are reading the contents of an HTTP request.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As a result, request validation errors might now occur for requests that previously did not trigger errors. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;==================================&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;To get asp.net 4.0 benefits including smaller viewstate, you need to clean that configuration or change that into this.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;pages controlRenderingCompatibilityVersion=&lt;span style="color: #006080"&gt;&amp;quot;4.0&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-7302934433858011222?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/0S65iXQJDPU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/0S65iXQJDPU/grab-aspnet-40-benefits.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>2</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/04/grab-aspnet-40-benefits.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-118563780840599953</guid><pubDate>Tue, 12 Apr 2011 07:36:00 +0000</pubDate><atom:updated>2011-04-12T17:39:08.419+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Entity Framework</category><category domain="http://www.blogger.com/atom/ns#">LINQ</category><title>Reference By Value for integer doesn’t work in entity framework / LINQ query</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Just find an interesting bugs, where I thought reference by value (int) can be used in entity framework or linq query.&lt;/p&gt;  &lt;p&gt;Here is the code &lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;&lt;br /&gt;lst = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;IQueryable&amp;lt;tblProduct&amp;gt;&amp;gt;();&lt;br /&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; choiceID = 30;&lt;br /&gt; lst.Add(from t &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; originalQuery&lt;br /&gt;         &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; t.tblProductChoiceTag.Any(c =&amp;gt; c.ChoiceID == choiceID)&lt;br /&gt;         select t);&lt;br /&gt; choiceID = 31;&lt;br /&gt; lst.Add(from t &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; originalQuery&lt;br /&gt;         &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; t.tblProductChoiceTag.Any(c =&amp;gt; c.ChoiceID == choiceID)&lt;br /&gt;         select t);&lt;br /&gt;       &lt;br /&gt;&lt;br /&gt;            IQueryable&amp;lt;tblProduct&amp;gt; q = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; first = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var tquery &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; lst)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (first)&lt;br /&gt;                {&lt;br /&gt;                    q = tquery;&lt;br /&gt;                    first = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br /&gt;                }&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;                {   &lt;span style="color: #008000"&gt;//the next one combine it&lt;/span&gt;&lt;br /&gt;                    q = q.Union(tquery);&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;            }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;When it executed, linq query will use the last choiceID (31) and override (30). &lt;br /&gt;  &lt;br /&gt;This really weird, because I thought It is saved to use the same (int) variable because it will pass by value. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;Here is another example &lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;var q = (from t &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; DBHelper.Instance.tblProductVariation&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; t.ProductID == pid&lt;br /&gt;                    &amp;amp;&amp;amp; t.tblChoice.Count == choices.Count&lt;br /&gt;                    select t);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var c &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; choices)&lt;br /&gt;            {&lt;br /&gt;                q = (from t &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; q&lt;br /&gt;                     &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; t.tblChoice.Any(ch=&amp;gt;ch.ChoiceID == c.ChoiceID)&lt;br /&gt;                     select t);&lt;br /&gt;            }&lt;br /&gt;              a&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; q.FirstOrDefault();&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;See on this query which the value will be iterating from the choice object&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;q = (from t &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; q&lt;br /&gt;&lt;span style="color: #0000ff"&gt;where&lt;/span&gt; t.tblChoice.Any(ch=&amp;gt;ch.ChoiceID == c.ChoiceID)&lt;br /&gt;select t);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;this code will pass the same value of choiceID. &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;To fix this you need to change it into local variable.&lt;br /&gt;&lt;br /&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;var cid = c.ChoiceID;&lt;br /&gt;&lt;br /&gt;q = (from t &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; q&lt;br /&gt;&lt;span style="color: #0000ff"&gt;where&lt;/span&gt; t.tblChoice.Any(ch=&amp;gt;ch.ChoiceID == cid)&lt;br /&gt;select t);&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Anyone can explain this ?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-118563780840599953?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/IzJjSSo-Ic4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/IzJjSSo-Ic4/reference-by-value-for-integer-doesnt.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/04/reference-by-value-for-integer-doesnt.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-2619022236428321105</guid><pubDate>Fri, 08 Apr 2011 00:45:00 +0000</pubDate><atom:updated>2011-04-08T10:47:21.547+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">AJAX</category><title>Firefox Update panel after 2 mins idle time</title><description>&lt;p&gt;Recently, I fight with firefox bug which aborting my partial postback from update panel after 2 mins idle time.&lt;/p&gt;  &lt;p&gt;Here was my step to investigate this problem&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;check other browsers (IE, IE6, Chrome) – and the result, only firefox does this weird behaviour&lt;/li&gt;    &lt;li&gt;create simple update panel and tested on FF. – unfortunately this work perfectly     &lt;br /&gt;and then I wonder why my actual code does not work.&lt;/li&gt;    &lt;li&gt;Apply more content on Update Panel – It is not work again &lt;em&gt;(oh my be it’s I need to make my content on update panel smaller)&lt;/em&gt;&lt;/li&gt;    &lt;li&gt;After trying to make my update panel content smaller, it still not work.&lt;/li&gt;    &lt;li&gt;Then I use my previous simple update panel to test if it is content outside update panel is matter. – (Yes, it is the content outside update panel is matter)&lt;/li&gt;    &lt;li&gt;Confuse how I solve this, we still need to use update panel for particular reason because of the due date, etc. so we can’t change anything (we have to keep the update panel but has to work in FF)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;After looking around the solutions, luckily I found on the other section of my project work perfectly after 2 mins idle in FF.&lt;/p&gt;  &lt;p&gt;I try to investigate why that section work but not this. Finally I figure out that the different is that part is calling ajax call on other page before call partial postback.&lt;/p&gt;  &lt;p&gt;Then here is my simple solutions to fix this.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Register Begin Request     &lt;br /&gt;Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(microsoftAJAX_BeginRequest);&lt;/li&gt;    &lt;li&gt;check the browser if it is mozilla and the time difference is 2 mins then request to other &lt;strong&gt;server page (ASPX page) &lt;/strong&gt;first synchonously before continue the process.      &lt;br /&gt;      &lt;br /&gt;Here is the code, hopefully it will help your problem as well.      &lt;br /&gt;      &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;       &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #008000"&gt;//check availability for partial postback for FF fixed. FF will abort the partial postback call after 2 mins unless it call ajax to other page first&lt;/span&gt;&lt;br /&gt; var checkConnectionForPartialPostback = function ()&lt;br /&gt; {&lt;br /&gt;     $.ajax({&lt;br /&gt;         url: &lt;span style="color: #006080"&gt;&amp;quot;/usercontrols/testconnection.aspx&amp;quot;&lt;/span&gt;,&lt;br /&gt;         async: &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;&lt;br /&gt;     });&lt;br /&gt; };&lt;br /&gt;&lt;br /&gt; &lt;span style="color: #008000"&gt;//check availability for partial postback for FF fixed. FF will abort the partial postback call after 2 mins unless it call ajax to other page first&lt;/span&gt;&lt;br /&gt; var checkAvailabilityForPartialPostback = function ()&lt;br /&gt; {&lt;br /&gt;     &lt;span style="color: #008000"&gt;//firefox fix for time diff        &lt;/span&gt;&lt;br /&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($.browser.mozilla &amp;amp;&amp;amp; GetTimeDiff(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Date(), lastLoadTime).getMinutes() &amp;gt;= 2)&lt;br /&gt;     {&lt;br /&gt;         &lt;span style="color: #008000"&gt;//refresh this page            &lt;/span&gt;&lt;br /&gt;         checkConnectionForPartialPostback();&lt;br /&gt;     }&lt;br /&gt;     &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;     {&lt;br /&gt;         lastLoadTime = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Date();&lt;br /&gt;     }&lt;br /&gt; };&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-2619022236428321105?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/s5KJNjqv4Ds" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/s5KJNjqv4Ds/firefox-update-panel-after-2-mins-idle.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>2</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/04/firefox-update-panel-after-2-mins-idle.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-2063469884706927165</guid><pubDate>Wed, 06 Apr 2011 08:45:00 +0000</pubDate><atom:updated>2011-04-08T10:49:46.989+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Internet</category><title>IE9–Fastest Browser ?</title><description>&lt;p&gt;Some people said that IE9 aim to be the fastest browser in the world.&lt;/p&gt;  &lt;p&gt;Is that true ? Check this out and compare it with other browser&lt;/p&gt;  &lt;p&gt;&lt;a title="http://ie.microsoft.com/testdrive/Performance/KungFu/Default.html" href="http://ie.microsoft.com/testdrive/Performance/KungFu/Default.html"&gt;http://ie.microsoft.com/testdrive/Performance/KungFu/Default.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-2063469884706927165?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/G_cGsHANV-s" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/G_cGsHANV-s/ie9fastest-browser.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/04/ie9fastest-browser.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-4858880996901239823</guid><pubDate>Wed, 06 Apr 2011 08:40:00 +0000</pubDate><atom:updated>2011-04-08T10:50:31.511+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Internet</category><title>Basic Geolocation example</title><description>&lt;p&gt;Here is some basic geolocation example and display it to google maps.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;js/jquery-1.4.2.min.js&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;script src=&lt;span style="color: #006080"&gt;&amp;quot;js/yqlgeo.js&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;script&amp;gt;&lt;br /&gt;    jQuery(window).ready(function(){&lt;br /&gt;        jQuery(&lt;span style="color: #006080"&gt;&amp;quot;#btnInit&amp;quot;&lt;/span&gt;).click(initiate_geolocation);&lt;br /&gt;    })&lt;br /&gt;&lt;br /&gt;    function initiate_geolocation() {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (navigator.geolocation)&lt;br /&gt;        {&lt;br /&gt;            navigator.geolocation.getCurrentPosition(handle_geolocation_query, handle_errors);&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            yqlgeo.get(&lt;span style="color: #006080"&gt;'visitor'&lt;/span&gt;, normalize_yql_response);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    function handle_errors(error)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;switch&lt;/span&gt;(error.code)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; error.PERMISSION_DENIED: alert(&lt;span style="color: #006080"&gt;&amp;quot;user did not share geolocation data&amp;quot;&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; error.POSITION_UNAVAILABLE: alert(&lt;span style="color: #006080"&gt;&amp;quot;could not detect current position&amp;quot;&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; error.TIMEOUT: alert(&lt;span style="color: #006080"&gt;&amp;quot;retrieving position timedout&amp;quot;&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;default&lt;/span&gt;: alert(&lt;span style="color: #006080"&gt;&amp;quot;unknown error&amp;quot;&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    function normalize_yql_response(response)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (response.error)&lt;br /&gt;        {&lt;br /&gt;            var error = { code : 0 };&lt;br /&gt;            handle_error(error);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        var position = {&lt;br /&gt;            coords :&lt;br /&gt;            {&lt;br /&gt;                latitude: response.place.centroid.latitude,&lt;br /&gt;                longitude: response.place.centroid.longitude&lt;br /&gt;            },&lt;br /&gt;            address :&lt;br /&gt;            {&lt;br /&gt;                city: response.place.locality2.content,&lt;br /&gt;                region: response.place.admin1.content,&lt;br /&gt;                country: response.place.country.content&lt;br /&gt;            }&lt;br /&gt;        };&lt;br /&gt;&lt;br /&gt;        handle_geolocation_query(position);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    function handle_geolocation_query(position){&lt;br /&gt;        alert(&lt;span style="color: #006080"&gt;'Lat: '&lt;/span&gt; + position.coords.latitude + &lt;span style="color: #006080"&gt;' '&lt;/span&gt; +&lt;br /&gt;              &lt;span style="color: #006080"&gt;'Lon: '&lt;/span&gt; + position.coords.latitude);&lt;br /&gt;        }&lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;div&amp;gt;&lt;br /&gt;      &amp;lt;button id=&lt;span style="color: #006080"&gt;&amp;quot;btnInit&amp;quot;&lt;/span&gt; &amp;gt;Find my location&amp;lt;/button&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;function handle_geolocation_query(position)&lt;br /&gt;{&lt;br /&gt;    var image_url = &lt;span style="color: #006080"&gt;&amp;quot;http://maps.google.com/maps/api/staticmap?sensor=false&amp;amp;center=&amp;quot;&lt;/span&gt; + position.coords.latitude + &lt;span style="color: #006080"&gt;&amp;quot;,&amp;quot;&lt;/span&gt; +&lt;br /&gt;                    position.coords.longitude + &lt;span style="color: #006080"&gt;&amp;quot;&amp;amp;zoom=14&amp;amp;size=300x400&amp;amp;markers=color:blue|label:S|&amp;quot;&lt;/span&gt; +&lt;br /&gt;                    position.coords.latitude + &lt;span style="color: #006080"&gt;','&lt;/span&gt; + position.coords.longitude;&lt;br /&gt;&lt;br /&gt;    jQuery(&lt;span style="color: #006080"&gt;&amp;quot;#map&amp;quot;&lt;/span&gt;).remove();&lt;br /&gt;    jQuery(document.body).append(&lt;br /&gt;        jQuery(document.createElement(&lt;span style="color: #006080"&gt;&amp;quot;img&amp;quot;&lt;/span&gt;)).attr(&lt;span style="color: #006080"&gt;&amp;quot;src&amp;quot;&lt;/span&gt;, image_url).attr(&lt;span style="color: #006080"&gt;'id'&lt;/span&gt;,&lt;span style="color: #006080"&gt;'map'&lt;/span&gt;)&lt;br /&gt;    );&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-4858880996901239823?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/ijy9vPz9Pa4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/ijy9vPz9Pa4/basic-geolocation-example.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/04/basic-geolocation-example.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-4042199390785767183</guid><pubDate>Wed, 06 Apr 2011 07:06:00 +0000</pubDate><atom:updated>2011-04-08T10:51:06.812+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">DEV TOOL</category><title>JQuery Intellisense in VS 2010</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you want&amp;#160; jquery intellisense in your visual studio like this the you can get the vsdoc file generator which hosted by damo&lt;/p&gt;  &lt;p&gt;&lt;a title="http://damianedwards.com/vsdoc/" href="http://damianedwards.com/vsdoc/"&gt;http://damianedwards.com/vsdoc/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_kEiMJawhtH8/TZwQ9-8eA_I/AAAAAAAAAeI/DTWrteXxVUQ/s1600-h/image%5B19%5D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_kEiMJawhtH8/TZwQ_I3HxUI/AAAAAAAAAeM/YG8mQc1-1L0/image_thumb%5B7%5D.png?imgmax=800" width="306" height="210" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-4042199390785767183?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/jagip2XnKew" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/jagip2XnKew/jquery-intellisense-in-vs-2010.html</link><author>noreply@blogger.com (Kurniawan)</author><media:thumbnail url="http://lh4.ggpht.com/_kEiMJawhtH8/TZwQ_I3HxUI/AAAAAAAAAeM/YG8mQc1-1L0/s72-c/image_thumb%5B7%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/04/jquery-intellisense-in-vs-2010.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-8884292119899283477</guid><pubDate>Tue, 29 Mar 2011 00:53:00 +0000</pubDate><atom:updated>2011-04-08T10:51:41.601+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">AJAX</category><title>Refresh Javascript</title><description>&lt;p&gt;Here are my favourite links to refresh or introduce Javascript to new comers.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.jslint.com/lint.html"&gt;http://www.jslint.com/lint.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://vimeo.com/18511621" href="http://vimeo.com/18511621"&gt;http://vimeo.com/18511621&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://developer.yahoo.com/yui/theater/" href="http://developer.yahoo.com/yui/theater/"&gt;http://developer.yahoo.com/yui/theater/&lt;/a&gt; by Douglas Crockford&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Javascript is a wild language which need to be tamed.    &lt;br /&gt;Here are some js pattern which I think best pattern to tackle down the scoping and closure issue which called (Module Pattern)&lt;/p&gt;  &lt;p&gt;&lt;a title="http://stackoverflow.com/questions/3722820/examples-of-practical-javascript-object-oriented-design-patterns" href="http://stackoverflow.com/questions/3722820/examples-of-practical-javascript-object-oriented-design-patterns"&gt;http://stackoverflow.com/questions/3722820/examples-of-practical-javascript-object-oriented-design-patterns&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Recently I build a framework called SiteUI which follows this pattern and give you protection and flexibility.    &lt;br /&gt;&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;SiteUI.BaseUI = function (options)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #008000"&gt;//default options&lt;/span&gt;&lt;br /&gt;    var defaultsOpt = {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//set it to false otherwise, when you disable from the ajax, it when postback it will enable all your control&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//but if you have other reason you can do so.&lt;/span&gt;&lt;br /&gt;        disableAllButtonOnSubmit: &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;,&lt;br /&gt;        ajaxProcessMessage: &lt;span style="color: #006080"&gt;&amp;quot;Processing...&amp;quot;&lt;/span&gt;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    var options = $.extend(defaultsOpt, options);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//optional value - to disable all button on submit or not&lt;/span&gt;&lt;br /&gt;    var disableAllButtonOnSubmit = options.disableAllButtonOnSubmit;&lt;br /&gt;    var setDisableAllButtonOnSubmit = function (&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)&lt;br /&gt;    {&lt;br /&gt;        disableAllButtonOnSubmit = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    var ajaxProcessMessage = options.ajaxProcessMessage;&lt;br /&gt;    var setAjaxProcessMessage = function (&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)&lt;br /&gt;    {&lt;br /&gt;        ajaxProcessMessage = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//Shopping Cart Control&lt;/span&gt;&lt;br /&gt;    var shoppingCartControl = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;    var ddlPostbackSelector = &lt;span style="color: #006080"&gt;'.ddlPostback'&lt;/span&gt;;&lt;br /&gt;    var txtPostbackSelector = &lt;span style="color: #006080"&gt;'.txtPostback'&lt;/span&gt;;&lt;br /&gt;    var btnPostbackSelector = &lt;span style="color: #006080"&gt;'.btnPostback'&lt;/span&gt;;&lt;br /&gt;    var chkPostbackSelector = &lt;span style="color: #006080"&gt;'.chkPostback'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;    var loadingSelector = &lt;span style="color: #006080"&gt;'.postbackLoading'&lt;/span&gt;;&lt;br /&gt;    var loaderHtml = &lt;span style="color: #006080"&gt;&amp;quot;&amp;lt;img src='/images/ajax-loader.gif' class='postbackLoading' style='width:15px;height:15px;position:absolute; z-index:9999;' /&amp;gt;&amp;quot;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    var isHideLoadingBeforePostbackTemporary = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//this to indication a form validator after call back - (CommonFormValidator.js option)        &lt;/span&gt;&lt;br /&gt;    var formValidator_CallBack = function (source, isValid)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//alert('formValidator_CallBack : ' + isValid);&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!isValid)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//not valid - hide loading temporary - because this will be called first before click happen                &lt;/span&gt;&lt;br /&gt;            isHideLoadingBeforePostbackTemporary = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//Show loading&lt;/span&gt;&lt;br /&gt;    var showLoadingBeforePostback = function (source, addLoadingToParent)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//alert('showLoadingBeforePostback isHideLoadingBeforePostbackTemporary: ' + isHideLoadingBeforePostbackTemporary);&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!isHideLoadingBeforePostbackTemporary)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//add loader html after&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (addLoadingToParent)&lt;br /&gt;            {&lt;br /&gt;                $(source).parent().after(loaderHtml);&lt;br /&gt;                showPageLoader(); &lt;span style="color: #008000"&gt;//show page loader&lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                $(source).after(loaderHtml);&lt;br /&gt;                showPageLoader(); &lt;span style="color: #008000"&gt;//show page loader&lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//set it to false again&lt;/span&gt;&lt;br /&gt;            isHideLoadingBeforePostbackTemporary = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//Clear Loading Function&lt;/span&gt;&lt;br /&gt;    var clearLoading = function ()&lt;br /&gt;    {&lt;br /&gt;        $(loadingSelector).remove();&lt;br /&gt;        hidePageLoader();&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//show Page loader - this using jquery.loader this will disable all the button automatically&lt;/span&gt;&lt;br /&gt;    var showPageLoader = function ()&lt;br /&gt;    {&lt;br /&gt;        $.loader({&lt;br /&gt;            className: &lt;span style="color: #006080"&gt;&amp;quot;loaderBox&amp;quot;&lt;/span&gt;,&lt;br /&gt;            content: &lt;span style="color: #006080"&gt;''&lt;/span&gt;&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//hide page loader&lt;/span&gt;&lt;br /&gt;    var hidePageLoader = function ()&lt;br /&gt;    {&lt;br /&gt;        $.loader(&lt;span style="color: #006080"&gt;'close'&lt;/span&gt;);&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//Show Hide Loading On Content&lt;/span&gt;&lt;br /&gt;    var showHideLoadingOnContent = function (contentSelector, isShow)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (isShow)&lt;br /&gt;        {&lt;br /&gt;            $(contentSelector).before(loaderHtml); &lt;span style="color: #008000"&gt;//add loader after it fades                    &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//show loading        &lt;/span&gt;&lt;br /&gt;            showPageLoader(); &lt;span style="color: #008000"&gt;//show page loader to hide&lt;/span&gt;&lt;br /&gt;            $(contentSelector).animate({ opacity: 0 }, 150);&lt;br /&gt;            &lt;span style="color: #008000"&gt;//$(contentSelector).effect('fade',null,500);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//hide loading - remove all loading selector&lt;/span&gt;&lt;br /&gt;            $(loadingSelector).remove(); &lt;span style="color: #008000"&gt;//remove loader first&lt;/span&gt;&lt;br /&gt;            hidePageLoader(); &lt;span style="color: #008000"&gt;// hide page loader&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//just in case if in the beginning it hides this&lt;/span&gt;&lt;br /&gt;            $(contentSelector).animate({ opacity: 1 }, 150);&lt;br /&gt;            &lt;span style="color: #008000"&gt;//$(contentSelector).effect('fade',null,500);&lt;/span&gt;&lt;br /&gt;        }&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//redirect content&lt;/span&gt;&lt;br /&gt;    var redirectContent = function (url, contentSelector)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (contentSelector)&lt;br /&gt;        {  &lt;span style="color: #008000"&gt;//only if they pass content selector we can redirect with show and hide loading&lt;/span&gt;&lt;br /&gt;            showHideLoadingOnContent(contentSelector, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        window.location = url;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//update content&lt;/span&gt;&lt;br /&gt;    var updateContent = function (responseText, contentSelector, updateContent_Callback)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        $(contentSelector).html(responseText);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (updateContent_Callback)&lt;br /&gt;            updateContent_Callback(responseText);&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//hide loading on content&lt;/span&gt;&lt;br /&gt;        showHideLoadingOnContent(contentSelector, &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;);&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//Used to track last Request Ajax URL&lt;/span&gt;&lt;br /&gt;    var lastRequestAjaxUrl = &lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//load content&lt;/span&gt;&lt;br /&gt;    var loadContent = function (ajaxUrl, relatedData, contentSelector, updateContent_Callback)&lt;br /&gt;    {&lt;br /&gt;        showHideLoadingOnContent(contentSelector, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;        lastRequestAjaxUrl = ajaxUrl;&lt;br /&gt;        $.ajax({&lt;br /&gt;            type: &lt;span style="color: #006080"&gt;&amp;quot;POST&amp;quot;&lt;/span&gt;,&lt;br /&gt;            url: ajaxUrl,&lt;br /&gt;            data: relatedData,&lt;br /&gt;            complete: function (data, stat)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #008000"&gt;//only process last request ajax url&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.url == lastRequestAjaxUrl)&lt;br /&gt;                {&lt;br /&gt;                    &lt;span style="color: #008000"&gt;//$.log(&amp;quot;Update this &amp;quot; + this.url + &amp;quot; VS &amp;quot; + lastRequestAjaxUrl);&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (stat == &lt;span style="color: #006080"&gt;&amp;quot;success&amp;quot;&lt;/span&gt;)&lt;br /&gt;                    {&lt;br /&gt;                        var isError = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;br /&gt;                        updateContent(data.responseText, contentSelector, updateContent_Callback);&lt;br /&gt;                    }&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;                    {&lt;br /&gt;                        updateContent(&lt;span style="color: #006080"&gt;&amp;quot;&amp;lt;p&amp;gt;Error Loading Data : &amp;quot;&lt;/span&gt; + stat + &lt;span style="color: #006080"&gt;' : '&lt;/span&gt; + data.responseText + &lt;span style="color: #006080"&gt;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;&lt;/span&gt;, contentSelector, updateContent_Callback);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;                {&lt;br /&gt;                    &lt;span style="color: #008000"&gt;//$.log(&amp;quot;Dispose this ajax &amp;quot; + this.url + &amp;quot; VS &amp;quot; + lastRequestAjaxUrl);&lt;/span&gt;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        });&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;// *************** MICROSOFT AJAX INIT - HANDLE ALL AJAX CALL*******************&lt;/span&gt;&lt;br /&gt;    var initMicrosoftAjaxRequest = function ()&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;/// &amp;lt;reference name=&amp;quot;MicrosoftAjax.js&amp;quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt; (Sys) != &lt;span style="color: #006080"&gt;'undefined'&lt;/span&gt; &amp;amp;&amp;amp; &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt; (Sys.WebForms) != &lt;span style="color: #006080"&gt;'undefined'&lt;/span&gt;)&lt;br /&gt;        {&lt;br /&gt;            Sys.Application.add_init(microsoftAJAX_App_Init);&lt;br /&gt;        }&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    var microsoftAJAX_App_Init = function ()&lt;br /&gt;    {&lt;br /&gt;        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(microsoftAJAX_BeginRequest);&lt;br /&gt;        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(microsoftAJAX_EndRequest);&lt;br /&gt;        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(microsoftAJAX_pageLoaded);&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    var postbackTriggerElement;&lt;br /&gt;    var microsoftAJAX_BeginRequest = function (sender, args)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (disableAllButtonOnSubmit)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//disable all button&lt;/span&gt;&lt;br /&gt;            disableAllSubmitButtons(&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;        postbackTriggerElement = args.get_postBackElement()&lt;br /&gt;        var ctrl = $(postbackTriggerElement);&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//remove all validation error&lt;/span&gt;&lt;br /&gt;        removeAllValidationError();&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ctrl.&lt;span style="color: #0000ff"&gt;is&lt;/span&gt;(&lt;span style="color: #006080"&gt;&amp;quot;input:checkbox&amp;quot;&lt;/span&gt;) || ctrl.&lt;span style="color: #0000ff"&gt;is&lt;/span&gt;(&lt;span style="color: #006080"&gt;&amp;quot;input:radio&amp;quot;&lt;/span&gt;))&lt;br /&gt;        {&lt;br /&gt;            ctrl.hide(); &lt;span style="color: #008000"&gt;//hide this check box&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!ctrl.hasClass(&lt;span style="color: #006080"&gt;&amp;quot;noLoaderOnPostback&amp;quot;&lt;/span&gt;))&lt;br /&gt;            {&lt;br /&gt;                showLoadingBeforePostback(ctrl, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;); &lt;span style="color: #008000"&gt;//show loading on this control   &lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ctrl.&lt;span style="color: #0000ff"&gt;is&lt;/span&gt;(&lt;span style="color: #006080"&gt;&amp;quot;input:submit&amp;quot;&lt;/span&gt;))&lt;br /&gt;        {  &lt;span style="color: #008000"&gt;//you can change it to other&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ctrl.hasClass(&lt;span style="color: #006080"&gt;&amp;quot;waitLabelOnPostback&amp;quot;&lt;/span&gt;))&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ajaxProcessMessage != &lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;)&lt;br /&gt;                {&lt;br /&gt;                    ctrl.val(ajaxProcessMessage);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ctrl.hasClass(&lt;span style="color: #006080"&gt;&amp;quot;disableOnPostback&amp;quot;&lt;/span&gt;))&lt;br /&gt;            {&lt;br /&gt;                ctrl.attr(&lt;span style="color: #006080"&gt;'disabled'&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;); &lt;span style="color: #008000"&gt;//disable but later on postback it will enable or disable based on the behaviour&lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!ctrl.hasClass(&lt;span style="color: #006080"&gt;&amp;quot;noLoaderOnPostback&amp;quot;&lt;/span&gt;))&lt;br /&gt;            {&lt;br /&gt;                showLoadingBeforePostback(ctrl);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;        {   &lt;span style="color: #008000"&gt;//other items show loading&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//show loading on this control                &lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!ctrl.hasClass(&lt;span style="color: #006080"&gt;&amp;quot;noLoaderOnPostback&amp;quot;&lt;/span&gt;))&lt;br /&gt;            {&lt;br /&gt;                showLoadingBeforePostback(ctrl);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    var microsoftAJAX_pageLoaded = function (sender, args)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!postbackTriggerElement)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//get updated panels and referesh&lt;/span&gt;&lt;br /&gt;        var updatedPanels = args.get_panelsUpdated();&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (i = 0; i &amp;lt; updatedPanels.length; i++)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//apply filter textbox&lt;/span&gt;&lt;br /&gt;            setFilterTextbox(updatedPanels[i].id);&lt;br /&gt;            &lt;span style="color: #008000"&gt;//set rating &lt;/span&gt;&lt;br /&gt;            setRating(updatedPanels[i].id);&lt;br /&gt;            &lt;span style="color: #008000"&gt;//set date picker&lt;/span&gt;&lt;br /&gt;            setDatePicker(updatedPanels[i].id);&lt;br /&gt;            &lt;span style="color: #008000"&gt;//set text area counter&lt;/span&gt;&lt;br /&gt;            setTextAreaCounter(updatedPanels[i].id);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//Call Microsoft AJAX_EndRequest_AdditionalFunciton() if available            &lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt; (microsoftAJAX_PageLoaded_AdditionalFunction) == &lt;span style="color: #006080"&gt;'function'&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                microsoftAJAX_PageLoaded_AdditionalFunction(updatedPanels[i].id);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//end request&lt;/span&gt;&lt;br /&gt;    var microsoftAJAX_EndRequest = function (sender, args)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (args.get_error() != undefined)&lt;br /&gt;        {&lt;br /&gt;            var errorMessage = args.get_error().message;&lt;br /&gt;            args.set_errorHandled(&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;br /&gt;            alert(&lt;span style="color: #006080"&gt;&amp;quot;Error in ajax call : &amp;quot;&lt;/span&gt; + errorMessage);&lt;br /&gt;            clearLoading(); &lt;span style="color: #008000"&gt;//clear loading&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (disableAllButtonOnSubmit)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//enable all button&lt;/span&gt;&lt;br /&gt;            disableAllSubmitButtons(&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//Call Microsoft AJAX_EndRequest_AdditionalFunciton() if available            &lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt; (microsoftAJAX_EndRequest_AdditionalFunction) == &lt;span style="color: #006080"&gt;'function'&lt;/span&gt;)&lt;br /&gt;        {&lt;br /&gt;            microsoftAJAX_EndRequest_AdditionalFunction();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//empty the postback element&lt;/span&gt;&lt;br /&gt;        postbackTriggerElement = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;        hidePageLoader(); &lt;span style="color: #008000"&gt;//hide page loader&lt;/span&gt;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//this can be override by calling set ajax page loaded&lt;/span&gt;&lt;br /&gt;    var microsoftAJAX_PageLoaded_AdditionalFunction = function (updatedPanelId)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//baseUI. microsoft AJAX Page Loaded Additional funxtion&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//you can write default function here&lt;/span&gt;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//this can be override by calling set ajax end request&lt;/span&gt;&lt;br /&gt;    var microsoftAJAX_EndRequest_AdditionalFunction = function ()&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//baseUI. microsoft AJAX End Request Additional funxtion&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//you can write default function here &lt;/span&gt;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//override ajax end request&lt;/span&gt;&lt;br /&gt;    var overrideMicrosoftAJAX_EndRequest_AdditionalFunction = function (func)&lt;br /&gt;    {&lt;br /&gt;        microsoftAJAX_EndRequest_AdditionalFunction = func;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//override ajax page loaded&lt;/span&gt;&lt;br /&gt;    var overrideMicrosoftAJAX_PageLoaded_AdditionalFunction = function (func)&lt;br /&gt;    {&lt;br /&gt;        microsoftAJAX_PageLoaded_AdditionalFunction = func;&lt;br /&gt;    };&lt;br /&gt;    &lt;span style="color: #008000"&gt;//-----------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//use for postback&lt;/span&gt;&lt;br /&gt;    var setupPostbackControlEvents = function ()&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//show loading before postback&lt;/span&gt;&lt;br /&gt;        $(ddlPostbackSelector).live(&lt;span style="color: #006080"&gt;&amp;quot;change&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//e.preventDefault();//cannot prevent default, it won't go to onclick&lt;/span&gt;&lt;br /&gt;            showLoadingBeforePostback(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//filter search keyword&lt;/span&gt;&lt;br /&gt;        $(txtPostbackSelector).live(&lt;span style="color: #006080"&gt;&amp;quot;change&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//e.preventDefault();//cannot prevent default, it won't go to onclick&lt;/span&gt;&lt;br /&gt;            showLoadingBeforePostback(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        $(btnPostbackSelector).live(&lt;span style="color: #006080"&gt;&amp;quot;click&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//e.preventDefault(); //cannot prevent default, it won't go to onclick&lt;/span&gt;&lt;br /&gt;            showLoadingBeforePostback(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).hasClass(&lt;span style="color: #006080"&gt;&amp;quot;clearValidation&amp;quot;&lt;/span&gt;))&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #008000"&gt;//check if it has class clear validation&lt;/span&gt;&lt;br /&gt;                removeAllValidationError();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        $(chkPostbackSelector + &lt;span style="color: #006080"&gt;&amp;quot; input&amp;quot;&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;change&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//e.preventDefault(); //cannot prevent default, it won't go to onclick&lt;/span&gt;&lt;br /&gt;            showLoadingBeforePostback(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;br /&gt;            removeAllValidationError(); &lt;span style="color: #008000"&gt;//it will clear validation - usually this will change the view&lt;/span&gt;&lt;br /&gt;        });&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//setup Dropdown Item&lt;/span&gt;&lt;br /&gt;    var setupDropdownItem = function ()&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//find drop down item trigger&lt;/span&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;'.dropdownItemTrigger'&lt;/span&gt;).each(function ()&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Make the drop down cart appear/disappear.&lt;/span&gt;&lt;br /&gt;            var boxSelector = $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).attr(&lt;span style="color: #006080"&gt;'rel'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Set natural height and other properties of hidable object.&lt;/span&gt;&lt;br /&gt;            $(boxSelector).data(&lt;span style="color: #006080"&gt;'naturalHeight'&lt;/span&gt;, $(boxSelector).height());&lt;br /&gt;            $(boxSelector).addClass(&lt;span style="color: #006080"&gt;'hidden'&lt;/span&gt;);&lt;br /&gt;            $(boxSelector).css(&lt;br /&gt;            {&lt;br /&gt;                display: &lt;span style="color: #006080"&gt;'none'&lt;/span&gt;,&lt;br /&gt;                bottom: &lt;span style="color: #006080"&gt;'auto'&lt;/span&gt;&lt;br /&gt;            });&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Create back reference.&lt;/span&gt;&lt;br /&gt;            $(boxSelector).data(&lt;span style="color: #006080"&gt;'trigger'&lt;/span&gt;, $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;));&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;'.dropdownItemTrigger'&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;click&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            e.preventDefault();&lt;br /&gt;&lt;br /&gt;            var $trigger = $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Don't do anything if the drop down item is already animating.&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($trigger.hasClass(&lt;span style="color: #006080"&gt;'disabled'&lt;/span&gt;)) &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Find direction.&lt;/span&gt;&lt;br /&gt;            var direction = $trigger.hasClass(&lt;span style="color: #006080"&gt;'maximise'&lt;/span&gt;) ? 1 : -1;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Find effect type.&lt;/span&gt;&lt;br /&gt;            var classes = $trigger.attr(&lt;span style="color: #006080"&gt;'class'&lt;/span&gt;); &lt;span style="color: #008000"&gt;//.match(/effect-/);&lt;/span&gt;&lt;br /&gt;            var effect = $trigger.attr(&lt;span style="color: #006080"&gt;'class'&lt;/span&gt;).match(/\beffect-[a-z]{1,}/);&lt;br /&gt;            &lt;span style="color: #008000"&gt;//alert(effect);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Make the drop down cart appear/disappear.&lt;/span&gt;&lt;br /&gt;            var boxSelector = $trigger.attr(&lt;span style="color: #006080"&gt;'rel'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (boxSelector == shoppingCartControl.shoppingCartControlSelector)&lt;br /&gt;            {&lt;br /&gt;                shoppingCartControl.checkToReload();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            $(boxSelector).trigger(&lt;span style="color: #006080"&gt;'dropdowntoggle'&lt;/span&gt;, [direction, effect]);&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;'.dropdownItem'&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;'dropdowntoggle'&lt;/span&gt;, function (e, direction, fxtype)&lt;br /&gt;        {&lt;br /&gt;            var $dropdownItem = $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;br /&gt;            var $trigger = $dropdownItem.data(&lt;span style="color: #006080"&gt;'trigger'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Ensure direction.&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (isNaN(direction)) direction = $dropdownItem.hasClass(&lt;span style="color: #006080"&gt;'shown'&lt;/span&gt;) ? -1 : 1;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Disable trigger.&lt;/span&gt;&lt;br /&gt;            $trigger.addClass(&lt;span style="color: #006080"&gt;'disabled'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Set states. / cursor            &lt;/span&gt;&lt;br /&gt;            $trigger.toggleClass(&lt;span style="color: #006080"&gt;'maximise'&lt;/span&gt;, direction == -1);&lt;br /&gt;            $trigger.toggleClass(&lt;span style="color: #006080"&gt;'minimise'&lt;/span&gt;, direction == 1);&lt;br /&gt;&lt;br /&gt;            $dropdownItem.toggleClass(&lt;span style="color: #006080"&gt;'hidden'&lt;/span&gt;, direction == -1);&lt;br /&gt;            $dropdownItem.toggleClass(&lt;span style="color: #006080"&gt;'shown'&lt;/span&gt;, direction == 1);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Effect &lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//var currPosition = $dropdownItem.css('top').replace(/([a-z]+)/, '') * 1&lt;/span&gt;&lt;br /&gt;            var currPosition; &lt;span style="color: #008000"&gt;// = direction == 1 ? $dropdownItem.height() * -1 : 0;&lt;/span&gt;&lt;br /&gt;            var displacement; &lt;span style="color: #008000"&gt;// = $dropdownItem.height(); //$dropdownItem.data('naturalHeight');&lt;/span&gt;&lt;br /&gt;            var newPosition; &lt;span style="color: #008000"&gt;// = currPosition + displacement * direction;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//alert(fxtype);&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Toggle drop down item + Effect&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (fxtype == &lt;span style="color: #006080"&gt;'effect-slide'&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #008000"&gt;// Calculate new values.&lt;/span&gt;&lt;br /&gt;                currPosition = direction == 1 ? ($dropdownItem.height() * -1) : 0 - 50;&lt;br /&gt;                displacement = $dropdownItem.height(); &lt;span style="color: #008000"&gt;//$dropdownItem.data('naturalHeight');&lt;/span&gt;&lt;br /&gt;                newPosition = currPosition + displacement * direction;&lt;br /&gt;&lt;br /&gt;                &lt;span style="color: #008000"&gt;// Execute&lt;/span&gt;&lt;br /&gt;                $dropdownItem.css(&lt;br /&gt;                        {&lt;br /&gt;                            display: &lt;span style="color: #006080"&gt;'block'&lt;/span&gt;,&lt;br /&gt;                            top: currPosition&lt;br /&gt;                        }).animate(&lt;br /&gt;                        {&lt;br /&gt;                            top: newPosition&lt;br /&gt;                        }, 400, function ()&lt;br /&gt;                        {&lt;br /&gt;                            $trigger.toggleClass(&lt;span style="color: #006080"&gt;'active'&lt;/span&gt;, direction == 1);&lt;br /&gt;&lt;br /&gt;                            $trigger.removeClass(&lt;span style="color: #006080"&gt;'disabled'&lt;/span&gt;);&lt;br /&gt;                        });&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #008000"&gt;// if (fxtype=='effect-fade') {&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #008000"&gt;// Calculate new values.&lt;/span&gt;&lt;br /&gt;                var currOpacity = direction == 1 ? 0 : 1;&lt;br /&gt;                var newOpacity = direction == 1 ? 1 : 0;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                &lt;span style="color: #008000"&gt;//Execute&lt;/span&gt;&lt;br /&gt;                $dropdownItem.css(&lt;br /&gt;                        {&lt;br /&gt;                            display: &lt;span style="color: #006080"&gt;'block'&lt;/span&gt;,&lt;br /&gt;                            top: 0,&lt;br /&gt;                            opacity: currOpacity&lt;br /&gt;                        }).animate(&lt;br /&gt;                        {&lt;br /&gt;                            opacity: newOpacity&lt;br /&gt;                        }, 400, function ()&lt;br /&gt;                        {&lt;br /&gt;                            $trigger.toggleClass(&lt;span style="color: #006080"&gt;'active'&lt;/span&gt;, direction == 1);&lt;br /&gt;                            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (direction == -1)&lt;br /&gt;                            {&lt;br /&gt;                                &lt;span style="color: #008000"&gt;//hide the display&lt;/span&gt;&lt;br /&gt;                                $dropdownItem.css({display: &lt;span style="color: #006080"&gt;'none'&lt;/span&gt;});&lt;br /&gt;                            }&lt;br /&gt;                            $trigger.removeClass(&lt;span style="color: #006080"&gt;'disabled'&lt;/span&gt;);&lt;br /&gt;                        });&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        });&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;/*this doesn't work for shopping cart in IE 6*/&lt;/span&gt;&lt;br /&gt;    var setupDropdownItemUsingJqueryUI = function ()&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//Bind Drop down item - just require this button&lt;/span&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;'.dropdownItemTriggerBlind'&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;click&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            e.preventDefault();&lt;br /&gt;&lt;br /&gt;            var $trigger = $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: #008000"&gt;// Make the drop down cart appear/disappear.&lt;/span&gt;&lt;br /&gt;            var boxSelector = $trigger.attr(&lt;span style="color: #006080"&gt;'rel'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//check if it is shopping cart control&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (boxSelector == shoppingCartControl.shoppingCartControlSelector)&lt;br /&gt;            {&lt;br /&gt;                shoppingCartControl.checkToReload();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//using jquery.ui toggle( effect, [options], [speed], [callback] )&lt;/span&gt;&lt;br /&gt;            $(boxSelector).toggle(&lt;span style="color: #006080"&gt;'blind'&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, 300);&lt;br /&gt;&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;/*Setup Events - This will be call unsynchronously*/&lt;/span&gt;&lt;br /&gt;    var setupEvents = function ()&lt;br /&gt;    {   &lt;span style="color: #008000"&gt;//setup postback control events&lt;/span&gt;&lt;br /&gt;        setupPostbackControlEvents();&lt;br /&gt;        &lt;span style="color: #008000"&gt;//setup drop down&lt;/span&gt;&lt;br /&gt;        setupDropdownItem();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//for login trigger       &lt;/span&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;.txtTriggerLogin&amp;quot;&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;change&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            $(&lt;span style="color: #006080"&gt;&amp;quot;.btnLogin&amp;quot;&lt;/span&gt;).click();&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;.txtTriggerLogin&amp;quot;&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;keypress&amp;quot;&lt;/span&gt;, function (e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #008000"&gt;//$.log('run from DISABLE DEFAULT BUtton');&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; runFunctionOnEnter(e,&lt;br /&gt;                    function ()&lt;br /&gt;                    {&lt;br /&gt;                        $(&lt;span style="color: #006080"&gt;&amp;quot;.btnLogin&amp;quot;&lt;/span&gt;).click();&lt;br /&gt;                    }&lt;br /&gt;                );&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// Removes SEO text in navItems&lt;/span&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;.clearText&amp;quot;&lt;/span&gt;).html(&lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;);&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;.clearText&amp;quot;&lt;/span&gt;).removeClass(&lt;span style="color: #006080"&gt;&amp;quot;clearText&amp;quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// Clears input fields on Focus&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// Title must match the value to clear.&lt;/span&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;.clearField&amp;quot;&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;blur&amp;quot;&lt;/span&gt;, function ()&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).val() == &lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).val($(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).attr(&lt;span style="color: #006080"&gt;&amp;quot;title&amp;quot;&lt;/span&gt;));&lt;br /&gt;            };&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;&amp;quot;.clearField&amp;quot;&lt;/span&gt;).live(&lt;span style="color: #006080"&gt;&amp;quot;focus&amp;quot;&lt;/span&gt;, function ()&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).val() == $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).attr(&lt;span style="color: #006080"&gt;&amp;quot;title&amp;quot;&lt;/span&gt;))&lt;br /&gt;            {&lt;br /&gt;                $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).val(&lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;);&lt;br /&gt;            };&lt;br /&gt;        });&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//bind shopping cart&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//cart = new SiteUI.ShoppingCart();&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//cart.updateCartHover();&lt;/span&gt;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;/*Constructor*/&lt;/span&gt;&lt;br /&gt;    var bindDefaultBehaviour = function ()&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;//init ajax request behaviour&lt;/span&gt;&lt;br /&gt;        initMicrosoftAjaxRequest();&lt;br /&gt;        &lt;span style="color: #008000"&gt;//disable default button&lt;/span&gt;&lt;br /&gt;        disableDefaultButton();&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//set droppy menu&lt;/span&gt;&lt;br /&gt;        $(&lt;span style="color: #006080"&gt;'#dropdownNavigation'&lt;/span&gt;).droppy();&lt;br /&gt;&lt;br /&gt;        shoppingCartControl = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SiteUI.ShoppingCartControl();&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;//run this async&lt;/span&gt;&lt;br /&gt;        setTimeout(function ()&lt;br /&gt;        {&lt;br /&gt;            setupEvents();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #008000"&gt;//apply filter textbox&lt;/span&gt;&lt;br /&gt;            setFilterTextbox();&lt;br /&gt;&lt;br /&gt;            setRating();&lt;br /&gt;            setDatePicker();&lt;br /&gt;            setTextAreaCounter();&lt;br /&gt;&lt;br /&gt;        }, 0);&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    var init = function ()&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;//return public method&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; {&lt;br /&gt;        bindDefaultBehaviour: bindDefaultBehaviour,&lt;br /&gt;        formValidator_CallBack: formValidator_CallBack,&lt;br /&gt;        redirectContent: redirectContent,&lt;br /&gt;        setupPostbackControlEvents: setupPostbackControlEvents,&lt;br /&gt;&lt;br /&gt;        loadContent: loadContent,&lt;br /&gt;        updateContent: updateContent,&lt;br /&gt;&lt;br /&gt;        clearLoading: clearLoading,&lt;br /&gt;        showLoadingBeforePostback: showLoadingBeforePostback,&lt;br /&gt;        showHideLoadingOnContent: showHideLoadingOnContent,&lt;br /&gt;&lt;br /&gt;        showPageLoader: showPageLoader,&lt;br /&gt;        hidePageLoader: hidePageLoader,&lt;br /&gt;&lt;br /&gt;        setAjaxProcessMessage: setAjaxProcessMessage,&lt;br /&gt;        setDisableAllButtonOnSubmit: setDisableAllButtonOnSubmit,&lt;br /&gt;        overrideMicrosoftAJAX_EndRequest_AdditionalFunction: overrideMicrosoftAJAX_EndRequest_AdditionalFunction,&lt;br /&gt;        overrideMicrosoftAJAX_PageLoaded_AdditionalFunction: overrideMicrosoftAJAX_PageLoaded_AdditionalFunction&lt;br /&gt;    };&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-8884292119899283477?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/xLC-XLL4qTA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/xLC-XLL4qTA/refresh-javascript.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/03/refresh-javascript.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-8862653779689385339</guid><pubDate>Mon, 28 Mar 2011 03:05:00 +0000</pubDate><atom:updated>2011-04-08T10:52:04.812+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><title>Page Load VS Init</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Most web developer already inherits the wrong culture of population of data.    &lt;br /&gt;After they graduate from college, without knowing and really understand of page life cycle and state management, They are prune to inherits the bad habits of the culture.&lt;/p&gt;  &lt;p&gt;Here are some of the culture which you may still see it in your current project to populate an item.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;&amp;lt;asp:DropdownList id=&lt;span style="color: #006080"&gt;&amp;quot;lstStates&amp;quot;&lt;/span&gt; runat=&lt;span style="color: #006080"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;    DataTextField=&lt;span style="color: #006080"&gt;&amp;quot;StateName&amp;quot;&lt;/span&gt; DataValueField=&lt;span style="color: #006080"&gt;&amp;quot;StateCode&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnLoad(EventArgs args) &lt;br /&gt;{    &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(!&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.IsPostback) &lt;br /&gt;    {        &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.lstStates.DataSource = QueryDatabase();        &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.lstStates.DataBind();    &lt;br /&gt;    }    &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;.OnLoad(e);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As is the nature of databound controls in ASP.NET, the state dropdown will be using ViewState to remember it's databound list of list items. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;At the time of this ranting, there are a total of States or countries. Not only does the dropdown list contain a ListItem for each and every state, but each and every one of those states and their state codes are being serialized into the encoded ViewState. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;That's a lot of data to be stuffing down the pipe every time the page loads, especially over a dialup connection. I often wonder what it would be like if I explained to my grandmother the reason why her internet is so slow is because her computer is telling the server what all the States / Countries are. Too bad... those extra states and countries dropdown list are really wearing down your bandwidth. &lt;br /&gt;  &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Like the problem with static data, the general solution to this problem is to just disable ViewState on the control. Unfortunately, that is not always going to work. Whether it does depends on the nature of the control you are binding, and what features of it you are dependant on. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In this example, if we simply added EnableViewState=&amp;quot;false&amp;quot; to the dropdown, and removed the if(!this.IsPostback) condition, we would successfully remove the state data from ViewState, but we would immediately run into a troubling problem. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The dropdown will no longer restore it's selected item on postbacks. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;WAIT!!! &lt;/strong&gt;This is another source of confusion with &lt;strong&gt;ViewState&lt;/strong&gt;. &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;The reason the dropdown fails to remember it's selected item on postbacks is NOT because you have disabled ViewState on it. &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Postback controls such as dropdownlist and textbox restore their posted state (the selected item of a dropdown ist 'posted') even when ViewState is disabled, because even with ViewState disabled the control is still able to post its value. &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;It forgets it's selected value because you are rebinding it in OnLoad, which is after the dropdown has already loaded it's posted value. When you databind it again, the first thing it does is throw that into the bit bucket (you know, digital trash). That means if a user selects California from the list, then click on a submit button, the dropdown will stubbornly return the default item (the first item if you don't specify it otherwise). &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Thankfully, there is an easy solution: Move the DataBind into OnInit: &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;asp:DropdownList id=&lt;span style="color: #006080"&gt;&amp;quot;lstStates&amp;quot;&lt;/span&gt; runat=&lt;span style="color: #006080"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;   DataTextField=&lt;span style="color: #006080"&gt;&amp;quot;StateName&amp;quot;&lt;/span&gt; DataValueField=&lt;span style="color: #006080"&gt;&amp;quot;StateCode&amp;quot;&lt;/span&gt; EnableViewState=&lt;span style="color: #006080"&gt;&amp;quot;false&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnInit(EventArgs args) &lt;br /&gt;{    &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.lstStates.DataSource = QueryDatabase();    &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.lstStates.DataBind();    &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;.OnInit(e);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Yes this will call QueryDatabase everytime you postback but you still can be solved it using simple caching instead of sacrificed the traffic performance in View state.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-8862653779689385339?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/ha3u9wt6zsg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/ha3u9wt6zsg/page-load-vs-init.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>1</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/03/page-load-vs-init.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-5851912139652220759</guid><pubDate>Mon, 28 Mar 2011 00:40:00 +0000</pubDate><atom:updated>2011-04-08T10:52:27.716+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">DESIGN PATTERN</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><title>MVP or MVC</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Recently, I am trying a very cool new architecture called WebForm MVP which comes as a mediator between Webform and MVC.&lt;/p&gt;  &lt;p&gt;This framework is very brilliant and explain the best practice for using Webform.&lt;/p&gt;  &lt;p&gt;For example the reason of using Page Init instead of Page load in regards of the viewstate.    &lt;br /&gt;This will enforce the best practice for the web developer to build there web application which now fully support for unit testing.&lt;/p&gt;  &lt;p&gt;You can check this at &lt;a title="http://webformsmvp.com/" href="http://webformsmvp.com/"&gt;http://webformsmvp.com/&lt;/a&gt;     &lt;br /&gt;and here is the contrib project which support common use presenter and Ioc Container such as Ninject and structure map.     &lt;br /&gt;&lt;a title="http://webformsmvpcontrib.codeplex.com/" href="http://webformsmvpcontrib.codeplex.com/"&gt;http://webformsmvpcontrib.codeplex.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I believe this project will soon be adopted by VS next release.&lt;/p&gt;  &lt;p&gt;Here is some brilliant article supported for this.    &lt;br /&gt;Viewstate - &lt;a title="http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx" href="http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx"&gt;http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-5851912139652220759?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/5d56Zqv1UXQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/5d56Zqv1UXQ/mvp-or-mvc.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>1</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/03/mvp-or-mvc.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-1508269938591996821</guid><pubDate>Fri, 11 Feb 2011 05:29:00 +0000</pubDate><atom:updated>2011-04-08T10:52:47.375+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Umbraco</category><title>Ghost node solve the crawling problem</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Finally After solve the ghost node, My crawling search start working again.&lt;/p&gt;  &lt;pre&gt;&lt;strong&gt;This query safe my time.&lt;/strong&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;SELECT * FROM umbracoNode, &lt;br /&gt;WHERE &lt;br /&gt;nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' -- that are of type 'Content'&lt;br /&gt;AND&lt;br /&gt;umbracoNode.id NOT IN (SELECT nodeId FROM cmsContent) -- but are not in the 'Content' table&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-1508269938591996821?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/Rt2DeZ9gGL0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/Rt2DeZ9gGL0/ghost-node-solve-crawling-problem.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/02/ghost-node-solve-crawling-problem.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-7136839829690266919</guid><pubDate>Fri, 11 Feb 2011 05:17:00 +0000</pubDate><atom:updated>2011-04-08T10:52:59.751+10:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Umbraco</category><title>Fix for No Document exists with Version '00000000-0000-0000-0000-000000000000' when sorting</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Finally I found what may cause the problem.&lt;/p&gt;  &lt;p&gt;It’s because I installed runway sitemap and in some reason, it create a ghost node&lt;/p&gt;  &lt;p&gt;&lt;a title="http://our.umbraco.org/forum/getting-started/questions-about-runway-and-modules/10685-No-Document-exists-with-Version-%2700000000-0000-0000-0000-000000000000%27?p=0#comment40259" href="http://our.umbraco.org/forum/getting-started/questions-about-runway-and-modules/10685-No-Document-exists-with-Version-%2700000000-0000-0000-0000-000000000000%27?p=0#comment40259"&gt;http://our.umbraco.org/forum/getting-started/questions-about-runway-and-modules/10685-No-Document-exists-with-Version-%2700000000-0000-0000-0000-000000000000%27?p=0#comment40259&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Do a select first to check&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;select * FROM umbracoNode     &lt;br /&gt;WHERE     &lt;br /&gt;umbracoNode.nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' -- that are of type 'Content'     &lt;br /&gt;AND     &lt;br /&gt;umbracoNode.id NOT IN (SELECT nodeId FROM cmsContent) -- but are not in the 'Content' table&lt;/p&gt;  &lt;p&gt;===&lt;/p&gt;  &lt;p&gt;and delete that node.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Delete FROM umbracoNode     &lt;br /&gt;WHERE     &lt;br /&gt;umbracoNode.nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' -- that are of type 'Content'     &lt;br /&gt;AND     &lt;br /&gt;umbracoNode.id NOT IN (SELECT nodeId FROM cmsContent) -- but are not in the 'Content' table&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-7136839829690266919?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/MO1QXDwBv74" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/MO1QXDwBv74/fix-for-no-document-exists-with-version.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>2</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/02/fix-for-no-document-exists-with-version.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-7254511583507369624</guid><pubDate>Fri, 28 Jan 2011 04:23:00 +0000</pubDate><atom:updated>2011-01-28T15:23:13.332+11:00</atom:updated><title>Umbraco Debug Script</title><description>&lt;p&gt;   &lt;br /&gt;Add this to your bookmark can be easier to debug Umbraco Macro error&lt;/p&gt;  &lt;p&gt;javascript:window.location=window.location+'?umbDebugShowTrace=true';&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-7254511583507369624?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/lJkN7uOq1Xk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/lJkN7uOq1Xk/umbraco-debug-script.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>1</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/01/umbraco-debug-script.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22121232.post-6776487693443293897</guid><pubDate>Wed, 12 Jan 2011 06:54:00 +0000</pubDate><atom:updated>2011-01-12T17:54:21.636+11:00</atom:updated><title>Session in Umbraco</title><description>&lt;p&gt;After looking around to fix things, finally I reliase that my session is always null in Umbraco.&lt;/p&gt;  &lt;p&gt;Which is unexpected accident for umbraco, and after couple hours, luckily I found the reason and how to solve it.&lt;/p&gt;  &lt;p&gt;Here is the reference.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://our.umbraco.org/forum/developers/extending-umbraco/4433-Accessing-Session-State-in-User-Control" href="http://our.umbraco.org/forum/developers/extending-umbraco/4433-Accessing-Session-State-in-User-Control"&gt;http://our.umbraco.org/forum/developers/extending-umbraco/4433-Accessing-Session-State-in-User-Control&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;you just need to add in web.config if you use IIS7&lt;/p&gt;  &lt;pre&gt;&amp;lt;modules runAllManagedModulesForAllRequests=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;Copyleft by : Kurniawan Kurniawan
Email Address: kkurni@gmail.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/22121232-6776487693443293897?l=kkurni.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/KurniawanBlogs/~4/7lHcTBZvqSI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/KurniawanBlogs/~3/7lHcTBZvqSI/session-in-umbraco.html</link><author>noreply@blogger.com (Kurniawan)</author><thr:total>0</thr:total><feedburner:origLink>http://kkurni.blogspot.com/2011/01/session-in-umbraco.html</feedburner:origLink></item><language>en-us</language><media:rating>nonadult</media:rating></channel></rss>

