July 2010 - Posts

Tips: Merge multiple CSV files into one

 

Task: Merge multiple CSV files into one

Solution: copy *.csv target.csv

Simple and neat!

Posted by Colt | 1 comment(s)
Filed under:

Set focus to a TextBox (in a ModalPopupExtender)

I have a web page where couple of ModalPopupExtender and Panel exist, and I want to set focus to TextBox inside the corresponding pop up window when user click the target button accordingly. I think it's a common requirement to set the focus to a specific TextBox immediately when user open up the window. However, I always get the error message "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus".

Understand that the modal pop up window and the TextBox inside are hidden by default, while setting focus on that TextBox upon the click of TargetControl seems impossible. Fortunately, google showed me an article by Jaspreet and he showed how he solve this problem by using the setTimeOut and two JavaScript functions (set the focus by 1 second delay).

Posted by Colt | 6 comment(s)
Filed under:

Turn TextBox.Text to CAPITAL or small letter in CSS

I'm looking for a simple function that turn the text of a TextBox into capital or small letter, but most of the JavaScript I found are clumsy because of the incompatibility of script (including the inconsistent behavior of event.keyCode and event.which in different browser).

Finally I found a pretty simple solution - CSS text-transform property do the work prettily. (http://www.w3.org/TR/CSS2/text.html#caps-prop)

E.g. [asp:TextBox ID="TextBox1" runat="server" style="text-transform:uppercase;" /]

Posted by Colt | 1 comment(s)
Filed under:
More Posts