Skip to main content

Posts

Showing posts from 2013

Deregistering ResgisterStartupScript

Yesterday was bit tricky until I found my solution to deregister the Startup script; we used to bind from code behind in asp.net. I have added the script using sys.application.add_load(); to show a simple popup but the problem is when an asyn postback happens again and again those alerts pops out ;). After few mins of googling found a solution from Microsoft support link that we can remove the handler using sys.application.remove_load(); Though the solution is not exactly deregistering, it still solves the problem. If you have any other solution for this, please post the same in comments. I have done with scriptmanager since the postback was through updatepanel. Code:  ScriptManager.RegisterStartupScript(updatePanelID, this.GetType(), "key",                  "Sys.Application.remove_load(jsMethodName);", true);

Creating multi module project with maven

Creating my first multi module project with maven I got a superb step by step article for maven project creation in eclipse while googling. This article is good for beginners like me :) , no need do too many things, just follow the steps at the end you will see “Hello World” in the browser. Check the below link for the wonderful article. http://skillshared.blogspot.in/2012/11/how-to-create-multi-module-project-with.html Thanks Semika Loku Kaluge

HIBERNATE (WITH @NNOTATION) IN WEB APPLICATION

In this post, am going to cover the basic way to setup the hibernate environment in eclipse to do a simple insert operation in mysql database and this post is meant for beginners who doesn't know about hibernate configurations coz am similar kind. I can't post this in codeproject coz it requires some more documentation so if you want the project files m essage me in G+  I will post you the project files. Folder structure & Libraries required :  It gives clear details about file placement and libraries required. Application setup: ·         JDK 6 ·         Eclipse Juno ·         Tomcat 7.0 ·         MySQL 5.1 ·         Supporting libraries for hibernate. Steps: ·         Creating project in Eclipse. ·...

Unable to convert MySQL date/time value to System.DateTime - Solved

Few days back I got an exception like 'Unable to convert Mysql date/time value to system.datetime' but this happened only after deploying and locally everything was working fine. After googling for sometimes found the reason that, it was due to the formatting difference between Mysql and C# also empty date value is causing some issue. Later found the below solution to fix'em. Add an extra property(Convert Zero Datetime = true) to connectino string. e.g server=localhost;User Id=root;password=pwd;database=test; Convert Zero Datetime=true Solution obtained from StackOverflow :)

Animated Gif not working when used with window.location

Today I came across a peculiar problem, might be known to many but I have never got into this before since this is the first time am trying this ;). Problem is like whenever location.href or window.location is used I can’t show animated GIF image as progress bar. I googled for few mins and found various solutions like using Iframe for the progress icon alone and some gave me some hack like adding src of the image tag again after navigation code. Code that wasn’t working: Function(){ Showprogressbar(); Location.href = “”; } But something strokes my mind to change the position like we used to do with Jquery plugins (when fighting to integrate multiple plugins) ;). This gave me a simple solution like below and it worked :) Working Code: Function(){ Location.href = “”; Showprogressbar(); } Hope it helps you too. If it doesn't post your problem as comment and I will try to give you the solution at the earliest.

Accessing parent-child (Iframe) from one another

I was wondering!! O.o, how could we access other page controls from a page using JavaScript/Jquery. But this sample gave me the solution. From Iframe page (child page) access Parent page controls: function AccessParentPage(){             var url = parent.document.referrer;             var obj = parent.document;             // this find can be used to find the control by id or by control type.             // then we can use the control the way usually do with client side              //scripting             $(obj).find(' control  name '); } From Iframe page (child page) access Parent page js methods: This is pretty simple you just need to add "parent" keyword in the beginning to call methods in parent page. eg. if " validate() " was the method in parent page then simply you can call " ...

Custom Treeview

Custom Treeview control useful when multilevel hierarchical data need to be displayed and setting default can go at any level and providing access to each level then this can be the right choice. Check the below link for the complete details on its usage and source code. http://www.codeproject.com/Tips/548924/Custom-Treeview

Find changeset details with changeset id in TFS

I want to know change set details and the only thing I know is change set id, are you in this situation without knowing how to? Find solution below coz I was is in this same state before few days and found the solution in one of the web site :). Open team explorer > source control explorer > Set the focus on Source Control Explorer in Visual studio and press CTRL+G Below window will pop up, give the change set id in it and then details will be shown in next window.

Currency formatting in C#

string .Format( "{0:c}" , 102); Using the above code will return a result like $102.00. Since by default $ sign comes and if you want to change the symbol to other like pound or sterling change the culture info details as the below code sample. string .Format( new CultureInfo ( "en-US" ), "{0:c}" , 102); // This code again gives $ symbol since I have used “en-US” ;). Please check the sample language codes below to use the symbol you require the complete list of language code is available in this url “http://msdn.microsoft.com/en-us/library/ms533052(v=vs.85).aspx”. en-us English (United States) en-gb English (United Kingdom) en-au English (Australia) en-ca English (Canada) en-nz English (New Zealand) en-ie English (Ireland) en-za English (South Africa) en-jm English (Jamaica) en English (Caribbean) en-bz English (Belize) ...