I am getting below error while calling User defined function in Telerik Report.
I didn't find anything wrong with this code.
"The error has occured while processing TextBox 'textBox1':
This expression contains undefined function call DateLeft().
Please See below code
this
.textBox1.Value = "= DateLeft(Fields.DateReleased,EndofMonths(Fields.Month))";
DataType of Fields.DateReleased is System.DateTime
DateType of Fields.Month is System.Int32.
Public static string DateLeft(DateTime ReleasedDate, DateTime EndofMonth)
{
string strReturn = "";
if ((ReleasedDate == null || ReleasedDate == DateTime.MinValue) || (EndofMonth != null && EndofMonth != DateTime.MinValue && ReleasedDate > EndofMonth.AddDays(1)))
strReturn = "IN JAIL";
else
strReturn = ReleasedDate.ToString("MM/dd/yyyy hh:mm");
return strReturn;
}
EndofMonth is another User defined function that passes as argument of above user defined function
public static DateTime EndofMonths(int parMonth)
{
if (parMonth == 12)
return new DateTime(DateTime.Now.Year, 1, 1);
else
return new DateTime(DateTime.Now.Year, parMonth + 1, 1);
}
I don't know but this error occurs only when Report first time open after user logged in application. After user second time open this report then this error don't occurs,
please review above code and give me reply what is the problem in above code.
I am waiting your reply. Please give me reply as soon as possible.
Thanks in advance.