Hi I finally solved it.
How I tracked it?
Enabling script debugging and used fiddler 2 tool and found whats going wrong. I found some error was thrown at date parsing.
What I did to solve? I wrote a method for datetime conversion as
public static bool ValidateDate(string txtDate, string sDateFormat, ref string sErrMsg, ref DateTime dtDate)
{
if (txtDate == "")
{
sErrMsg = "Please Enter Date";
return false;
}
else
{
System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo();
dateInfo.ShortDatePattern = sDateFormat;
try
{
dtDate = Convert.ToDateTime(txtDate, dateInfo);
return true;
}
catch
{
sErrMsg = "Please Enter Date In Correct Format";
return false;
}
}
}
then I used as
string errMsg = string.Empty;
Boolean IsFromDateValid = false;
DateTime fromDate = new DateTime();
IsFromDateValid = ValidateDate(wdpfrom.Text.Trim(), "dd/MM/yyyy", ref errMsg, ref fromDate);
if (IsFromDateValid == false)
{
ShowMessage(errMsg);
return;
}
Boolean IsToDateValid = false;
DateTime toDate = new DateTime();
IsToDateValid = ValidateDate(wdpTo.Text.Trim(), "dd/MM/yyyy", ref errMsg, ref toDate);
if (IsToDateValid == false)
{
ShowMessage(errMsg);
return;
}
else
{
TimeSpan ts = new TimeSpan(23, 59, 59);
toDate = toDate.Add(ts);
}
and finally passed parameter to SP as
cmdGetPost.Parameters.AddWithValue("@dateFrom", fromDate);
cmdGetPost.Parameters.AddWithValue("@dateTo", toDate);