Hi,
Is there a way to set the input (TextBox) control of the GridViewDateTimeColumn to ReadOnly or Enabled = false?
We would like to have the user select the date from the drop-down calendar only. And not allow anything to be entered into the TextBox.
Thanks,
Mike
Is there a way to set the input (TextBox) control of the GridViewDateTimeColumn to ReadOnly or Enabled = false?
We would like to have the user select the date from the drop-down calendar only. And not allow anything to be entered into the TextBox.
Thanks,
Mike
4 Answers, 1 is accepted
0
Accepted
Hello Michael,
Thank you for writing.
You can do that by accessing the date time editor in the CellEditorInitialized event, from where you can get the text box and make it read only. Here is an example:
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.
Regards,
Stefan
Telerik
Thank you for writing.
You can do that by accessing the date time editor in the CellEditorInitialized event, from where you can get the text box and make it read only. Here is an example:
void
radGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
RadDateTimeEditor dateEditor = e.ActiveEditor
as
RadDateTimeEditor;
if
(dateEditor !=
null
)
{
RadDateTimeEditorElement dateEditorElement = (RadDateTimeEditorElement)dateEditor.EditorElement;
dateEditorElement.TextBoxElement.TextBoxItem.ReadOnly =
true
;
}
}
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.
Regards,
Stefan
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
MikeB
Top achievements
Rank 1
answered on 11 Sep 2014, 05:05 PM
Thank you Stefan.
This is exactly what I needed.
Mike
This is exactly what I needed.
Mike
0
MikeB
Top achievements
Rank 1
answered on 11 Sep 2014, 10:08 PM
I have a follow up question.
The Calendar Popup is only shown when the drop down arrow is clicked.
Is there a way to display the Calendar Popup in the CellBeginEdit or CellEditorInitialized? And of course, close when the operator clicks on a date or clicks the drop down arrow.
Thanks again,
Mike
The Calendar Popup is only shown when the drop down arrow is clicked.
Is there a way to display the Calendar Popup in the CellBeginEdit or CellEditorInitialized? And of course, close when the operator clicks on a date or clicks the drop down arrow.
Thanks again,
Mike
0
Accepted
Hello Michael,
Here is one way to do that:
I hope that the provided information addresses your question.
Regards,
Stefan
Telerik
Here is one way to do that:
void
radGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
RadDateTimeEditor dateEditor = e.ActiveEditor
as
RadDateTimeEditor;
if
(dateEditor !=
null
)
{
RadDateTimeEditorElement dateEditorElement = (RadDateTimeEditorElement)dateEditor.EditorElement;
RadDateTimePickerCalendar calendarBehavior = dateEditorElement.GetCurrentBehavior()
as
RadDateTimePickerCalendar;
calendarBehavior.PopupControl.PopupClosed -= PopupControl_PopupClosed;
//avoids multiple subscriptions
calendarBehavior.PopupControl.PopupClosed += PopupControl_PopupClosed;
calendarBehavior.ShowDropDown();
}
}
void
PopupControl_PopupClosed(
object
sender, RadPopupClosedEventArgs args)
{
radGridView1.EndEdit();
}
I hope that the provided information addresses your question.
Regards,
Stefan
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.