Hi,
I used RadCalendar.NET2 ( Version: 2.2.1.0, Runtime Version: v2.0.50727)
I am using RadDatpicker Inside RadGrid.
I used CustomValidator to validate Date entered(typed into built in date inputbox) /selected(from calendar).
We have situation here:
When user changes date using Shared Calendar:
When user selects date using shared Calendar and if selected date does not belongs to validate range than associate ClientValidationFunction fire properly (e.g only once as it should be). Everything works fine.
When user changes date by typing into built-in Date input box:
When user changes date by typing into built-in date input box of Rad Date picker and if date does not belongs to validate date range, ClientValidationFunction fires twice. This create the problem. It should fire once only.
BTW: here is design code and javascript function that I used to validate entered/selected date.
<Design>
<EditItemTemplate>
<radCln:RadDatePicker ID="rdTransactionDate" runat="server" Width="110px" MinDate="1960/1/1"
MaxDate="2099/1/1" Calendar-Skin="Default2006" UseEmbeddedScripts="false">
</radCln:RadDatePicker>
<asp:CustomValidator ID="cvTransactionDate" runat="server" ClientValidationFunction="CheckDate"
ControlToValidate="rdTransactionDate" SetFocusOnError ="true" ></asp:CustomValidator>
</EditItemTemplate>
</Design>
<script language="javascript">
function CheckDate(source, arguments)
{
try
{
var ControlName = source.id;
var objDate = document.getElementById(ControlName.replace('cvTransactionDate','rdTransactionDate')).value;
var objYear = document.getElementById('ctl00_CntAdminBody_cmbyear');
var objCurYear = parseInt(objYear.value);
var objMinYear = objCurYear - 1;
var objMinDate = objMinYear + '-07-01';
var objMaxDate = objCurYear + '-06-30';
arguments.IsValid = true;
if(objDate < objMinDate || objDate > objMaxDate)
{
alert("Enter Date Between FinancialYear");
arguments.IsValid = false;
}
}
catch(e)
{
}
}
</script>
Please let me know what might be wrong here and also if there is any solution.
Best Regards,
Gaurav
I used RadCalendar.NET2 ( Version: 2.2.1.0, Runtime Version: v2.0.50727)
I am using RadDatpicker Inside RadGrid.
I used CustomValidator to validate Date entered(typed into built in date inputbox) /selected(from calendar).
We have situation here:
When user changes date using Shared Calendar:
When user selects date using shared Calendar and if selected date does not belongs to validate range than associate ClientValidationFunction fire properly (e.g only once as it should be). Everything works fine.
When user changes date by typing into built-in Date input box:
When user changes date by typing into built-in date input box of Rad Date picker and if date does not belongs to validate date range, ClientValidationFunction fires twice. This create the problem. It should fire once only.
BTW: here is design code and javascript function that I used to validate entered/selected date.
<Design>
<EditItemTemplate>
<radCln:RadDatePicker ID="rdTransactionDate" runat="server" Width="110px" MinDate="1960/1/1"
MaxDate="2099/1/1" Calendar-Skin="Default2006" UseEmbeddedScripts="false">
</radCln:RadDatePicker>
<asp:CustomValidator ID="cvTransactionDate" runat="server" ClientValidationFunction="CheckDate"
ControlToValidate="rdTransactionDate" SetFocusOnError ="true" ></asp:CustomValidator>
</EditItemTemplate>
</Design>
<script language="javascript">
function CheckDate(source, arguments)
{
try
{
var ControlName = source.id;
var objDate = document.getElementById(ControlName.replace('cvTransactionDate','rdTransactionDate')).value;
var objYear = document.getElementById('ctl00_CntAdminBody_cmbyear');
var objCurYear = parseInt(objYear.value);
var objMinYear = objCurYear - 1;
var objMinDate = objMinYear + '-07-01';
var objMaxDate = objCurYear + '-06-30';
arguments.IsValid = true;
if(objDate < objMinDate || objDate > objMaxDate)
{
alert("Enter Date Between FinancialYear");
arguments.IsValid = false;
}
}
catch(e)
{
}
}
</script>
Please let me know what might be wrong here and also if there is any solution.
Best Regards,
Gaurav