That is probably because you are calling your code on Page_Load; move the code to a seperate method and have a button click or something call your code. Also, this is a bug. You need to test for the absence of data else your script will bomb everytime someone tries to search and they leave the date field blank.
if(this.txt.Text == String.Empty)
{
//do something
}
Alternatively you can do
if(this.txt.Text == "")
{
//do something
}
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========