This is a migrated thread and some comments may be shown as answers.

add OnError to GridDateTimeColumn

2 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elliott
Top achievements
Rank 2
Elliott asked on 26 Jul 2011, 03:26 PM
Is it possible to add an OnError ClientEvent to the DatePicker control when a GridDateTimeColumn is opened for Edit?

there are 3 clientevents - OnDateSelected, OnPopupOpening, OnPopupClosing but not OnError

thanks
Marianne

2 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 29 Jul 2011, 01:19 PM
Hi Marianne,

You could try something, like this:

protected void RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem dataItem = (GridEditableItem)e.Item;
                RadDatePicker picker = (RadDatePicker)dataItem["DateTimeColumnUniqueName"].Controls[0];
                picker.DateInput.Attributes.Add("OnError", "DatePickerValidation(),return false");
                
            }
        }

Best wishes,
Andrey
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Elliott
Top achievements
Rank 2
answered on 29 Jul 2011, 01:32 PM
thanks
what I ended up doing was to check for an invalid entry in the textbox prior to any update
protected void rdpShipDate_SelectedDateChanged(object sender, EventArgs e)
{
    RadDatePicker rdpShipDate;
                         kode
    rdpShipDate = (sender as RadDatePicker);
    if (rdpShipDate.InvalidTextBoxValue.Length > 0)
    {
        return;
    }
Tags
Grid
Asked by
Elliott
Top achievements
Rank 2
Answers by
Andrey
Telerik team
Elliott
Top achievements
Rank 2
Share this question
or