an excellent article about Enter and the Button Click Event
list below is my funtion to link this event on server side:
public void EnterToSubmit(TextBox tb, AgImageButton bt)
{
string strVal = "if ((event.which&&event.which == 13)||(event.keyCode&&event.keyCode == 13)){document.forms[0].elements['"+bt.ClientID+"'].focus();return false;} else return true;";
tb.Attributes.Add("onkeydown",strVal);
}
Tuesday, November 21, 2006
Wednesday, October 04, 2006
Here is what you need to do if you run NUNIT testing a web application with value needs to be read from web.config:
- Copy the web.config file that you will read into the bin\debug directory of the test project.
- Look for a file with the .nunit extension (should be the same name as the test project's dll)
- Rename the web.config file to the same name as the nunit file but change .nunit to .config.
- Run your tests
Tuesday, May 30, 2006
Wednesday, May 24, 2006
I hate XSLT
Oh, I hate this so much!!
A variable can't be re-assigned. It's much easier if I can use any other stupid language to parse XML. In my opion, even Basic is much better than this most stupid XSLT parsing. I hope I can prove myself wrong in the future cause looks like there are many fans of this.
But for now, I'll warn anyone who start considering to solve a problem using XSLT: if you just want to parsing XML, then it's fine. But keep in mind if you want to add some extra logic into it, that will definately KILL you. (at least a lot of your time)
A variable can't be re-assigned. It's much easier if I can use any other stupid language to parse XML. In my opion, even Basic is much better than this most stupid XSLT parsing. I hope I can prove myself wrong in the future cause looks like there are many fans of this.
But for now, I'll warn anyone who start considering to solve a problem using XSLT: if you just want to parsing XML, then it's fine. But keep in mind if you want to add some extra logic into it, that will definately KILL you. (at least a lot of your time)
Sunday, May 21, 2006
very good article about parameter passing
A very good article about parameter passing in C#
I think I was confused at one point, but get really clear idea after reading this.
link
summary:
1. difference btw value variable and reference variable, e.g. int and a class
2. difference btw passing by value and passing by reference, this is different than type of variables
I think I was confused at one point, but get really clear idea after reading this.
link
summary:
1. difference btw value variable and reference variable, e.g. int and a class
2. difference btw passing by value and passing by reference, this is different than type of variables
Friday, May 05, 2006
javascript to jump focus
<INPUT maxLength=3 size=3 name="phone1" onKeyUp="JumpFocus(this,'phone2')"> -
<INPUT maxLength=3 size=3 name="phone2" onKeyUp="JumpFocus(this,'phone3')"> -
<INPUT maxLength=4 size=4 name="phone3" onKeyUp="JumpFocus(this,'sEmail')">
-------------javascript function-------------
function JumpFocus(currControl,nextControlName)
{
if(currControl.value.length == currControl.getAttribute("maxlength")) //jump focus to the next control
{
document.getElementById(nextControlName).focus();
}
}
<INPUT maxLength=3 size=3 name="phone2" onKeyUp="JumpFocus(this,'phone3')"> -
<INPUT maxLength=4 size=4 name="phone3" onKeyUp="JumpFocus(this,'sEmail')">
-------------javascript function-------------
function JumpFocus(currControl,nextControlName)
{
if(currControl.value.length == currControl.getAttribute("maxlength")) //jump focus to the next control
{
document.getElementById(nextControlName).focus();
}
}
Thursday, April 20, 2006
check null in sql
I am not sure if you will have to do this in SQL server, I am a little bit confused...
Anyhow, if you are interested in those null values in db2, you have to use
where [column name] is null
I vaguely remembered that you just us = in sql server. will have to double check it. Damn it, get too old to remember staff?
Anyhow, if you are interested in those null values in db2, you have to use
where [column name] is null
I vaguely remembered that you just us = in sql server. will have to double check it. Damn it, get too old to remember staff?
Friday, April 07, 2006
Wednesday, March 29, 2006
attach database using sql command
I didn't find a way to attach sql 2000 database to my new sql 2005 expression because I don't have all the client tool. but by using the "EXEC sp_attach_db" command you can easily attach a database.
example:
----------------------------------------------------------------
EXEC sp_attach_db @dbname = N'NewSpringboard_v2',
@filename1 = N'D:\Program Files\Microsoft SQL Server\MSSQL.2 \MSSQL\Data\NewSpringboard_v2_Data.mdf',
@filename2 = N'D:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data\NewSpringboard_v2_Log.ldf'
----------------------------------------------------------------
example:
----------------------------------------------------------------
EXEC sp_attach_db @dbname = N'NewSpringboard_v2',
@filename1 = N'D:\Program Files\Microsoft SQL Server\MSSQL.2 \MSSQL\Data\NewSpringboard_v2_Data.mdf',
@filename2 = N'D:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data\NewSpringboard_v2_Log.ldf'
----------------------------------------------------------------
Friday, February 17, 2006
ToString formating
this should be a basic C++ knowledge, but looks like it's easy to be forgotten. And even worse, hard to find it online since it's so basic.
if you have integer like 4,6,11. but you want to convert to string like "04","06","11", --- padding a "0" on the left if it's single digit.
then you should use this:
number.ToString("d2") // d means to decimal, where 2 means 2 digits format
if you have integer like 4,6,11. but you want to convert to string like "04","06","11", --- padding a "0" on the left if it's single digit.
then you should use this:
number.ToString("d2") // d means to decimal, where 2 means 2 digits format
Friday, January 13, 2006
using dataview to sort or filtering
couple tips when using rowfilter in dateview:
(1).
when using dataview to sort or filter, it's better to pass the sort expression or filtering expression when constructing the dataview.
example:
DataView dv =
new DataView(ds.Tables[0],strFilter,strSort,DataViewRowState.CurrentRows);
//strFilter is the filtering expression
//strSort is the sort expression
(2).
if a column name has space in it. (I hate this!!), use [column name]
ds.RowFilter = "DocumentType = 'sometype' and [Date Signed] = '2/3/06' "
(1).
when using dataview to sort or filter, it's better to pass the sort expression or filtering expression when constructing the dataview.
example:
DataView dv =
new DataView(ds.Tables[0],strFilter,strSort,DataViewRowState.CurrentRows);
//strFilter is the filtering expression
//strSort is the sort expression
(2).
if a column name has space in it. (I hate this!!), use [column name]
ds.RowFilter = "DocumentType = 'sometype' and [Date Signed] = '2/3/06' "
Subscribe to:
Posts (Atom)