Hello all. Been trying to solve a problem to no avail. Have tried everything I can. Basically trying to set the minimun and maximum values of a range validator residing inside RadGrid. But it's not working.
Here is my code.
And in code behind I have the following.
Here is my code.
<
telerik:GridTemplateColumn
DataField
=
"claim_date"
DataType
=
"System.DateTime"
FooterText
=
"Totals: "
HeaderText
=
"Date"
SortExpression
=
"claim_date"
UniqueName
=
"claim_date"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"claim_dateLabel"
runat
=
"server"
Text='<%# Eval("claim_date", "{0:MM/dd/yyyy}") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDatePicker
ID
=
"claim_dateTextBox"
runat
=
"server"
DBSelectedDate='<%# Bind("claim_date") %>' Width="100" />
<
asp:RequiredFieldValidator
ID
=
"fvDateRequiredFieldValidator"
runat
=
"server"
ErrorMessage
=
"Claim date is required"
ControlToValidate
=
"claim_dateTextBox"
ValidationGroup
=
"DataEntryChk"
Display
=
"Dynamic"
Font-Bold
=
"true"
/>
<
asp:RangeValidator
ID
=
"fvDateValidator"
Type
=
"Date"
ControlToValidate
=
"claim_dateTextBox"
runat
=
"server"
ErrorMessage
=
"Cannot save claim item. Please select/enter a date in the same month as the voucher month."
SetFocusOnError
=
"True"
ValidationGroup
=
"DataEntryChk"
Display
=
"Dynamic"
Font-Bold
=
"true"
/>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
And in code behind I have the following.
Protected Sub ClaimsGV_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles ClaimsGV.ItemCommand
If e.CommandName = RadGrid.UpdateCommandName Or e.CommandName = RadGrid.PerformInsertCommandName Or e.CommandName = RadGrid.EditCommandName Then
Dim editform As GridEditFormItem = DirectCast(DirectCast(e.Item, Telerik.Web.UI.GridDataItem).EditFormItem, GridEditFormItem)
'Dim editform As GridEditableItem = CType(e.Item, GridEditableItem)
Dim fvDateValidator As RangeValidator = CType(editform.FindControl("fvDateValidator"), RangeValidator)
If fvDateValidator IsNot Nothing And iMaxEndDate <> "" And iMinStartDate <> "" Then
fvDateValidator.Enabled = True
fvDateValidator.Visible = True
fvDateValidator.MinimumValue = iMinStartDate.ToShortDateString
fvDateValidator.MaximumValue = iMaxEndDate.Date.ToShortDateString
End If
End If
End Sub