I am trying to convert to telerik RadDateTimePicker.
Private
Function
CreateWebDateTimeEdit(
ByVal
controlName
As
String
,
ByVal
dateOffset
As
Integer
,
ByVal
dateMask
As
String
,
ByVal
minimumdate
As
DateTime,
ByVal
maximumdate
As
DateTime,
ByVal
variabledefault
As
String
)
As
WebDateTimeEdit
Dim
wdte
As
New
WebDateTimeEdit
wdte.ID = controlName
wdte.Value = DateTime.Now.AddDays(dateOffset)
wdte.DisplayModeFormat = dateMask
wdte.EditModeFormat = dateMask
If
ViewState(
"VariableValues"
) IsNot
Nothing
AndAlso
CType
(ViewState(
"VariableValues"
), Dictionary(Of
String
,
String
)).ContainsKey(controlName)
Then
wdte.Value =
CType
(ViewState(
"VariableValues"
), Dictionary(Of
String
,
String
)).Item(controlName)
ElseIf
variabledefault.Length > 0
AndAlso
Not
variabledefault.ToUpper.Equals(
"[$NONE$]"
)
Then
wdte.Value = DateTime.Parse(variabledefault)
End
If
wdte.MinValue = minimumdate
wdte.MaxValue = maximumdate
Return
wdte
End
Function
I tried the following.
Private
Function
CreateWebDateTimeEdit(
ByVal
controlName
As
String
,
ByVal
dateOffset
As
Integer
,
ByVal
dateMask
As
String
,
ByVal
minimumdate
As
DateTime,
ByVal
maximumdate
As
DateTime,
ByVal
variabledefault
As
String
)
As
RadDateTimePicker
Dim
wdte
As
New
RadDateTimePicker
wdte.ID = controlName
wdte.SelectedDate = DateTime.Now.AddDays(dateOffset)
wdte.DataInput.DisplayModeFormat = dateMask
'wdte.EditModeFormat = dateMask //did not find a match
If
ViewState(
"VariableValues"
) IsNot
Nothing
AndAlso
CType
(ViewState(
"VariableValues"
), Dictionary(Of
String
,
String
)).ContainsKey(controlName)
Then
'wdte.Value = CType(ViewState("VariableValues"), Dictionary(Of String, String)).Item(controlName)
wdte.SeletedDate =
CType
(ViewState(
"VariableValues"
), Dictionary(Of
String
,
String
)).Item(controlName)
ElseIf
variabledefault.Length > 0
AndAlso
Not
variabledefault.ToUpper.Equals(
"[$NONE$]"
)
Then
'wdte.Value = DateTime.Parse(variabledefault)
wdte.SeletedDate = DateTime.Parse(variabledefault)
End
If
wdte.MinDate = minimumdate
wdte.MaxDate = maximumdate
Return
wdte
End
Function
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
I am setting my date format to "M/dd/yyyy HH:mm"
It is changing to M-dd-yyyy-hh-mm