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

How to compare two dates in RadGrid GridBoundColumn

1 Answer 101 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 17 May 2017, 08:10 PM

Hello there,

I have a requirement to validate that an expiration date is later than a hire date. Both dates are populated in a GridBoundColumn in a RadGrid. Bellow is the code for the two columns in my aspx page:

<telerik:GridBoundColumn ColumnEditorID="DateEditor" DataField="Hired" Visible="true" ReadOnly="false" HeaderText="Hired" UniqueName="gcHired" DataType="System.String" FilterControlAltText="Filter gcHired column"></telerik:GridBoundColumn>
                                                <telerik:GridDateTimeColumn ColumnEditorID="DateEditor" MinDate="2017-01-01" MaxDate="2030-12-31" DataFormatString="{0:MM/dd/yyyy}" DataField="Expires" HeaderText="Expires" UniqueName="gcExpires" FilterControlAltText="Filter column column" AllowFiltering="False" AllowSorting="False" DataType="System.DateTime" ReadOnly="false">
                                                    <HeaderStyle Width="100px"></HeaderStyle>
                                                </telerik:GridDateTimeColumn>

 

I am wondering if there is a straight forward way to achieve this. Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 19 May 2017, 10:57 AM

Hello,

I have just answered your support ticket with the same question which indicated the grid is in Batch edit mode.

I am pasting my answer here for others with a similar question.

I suggest you review the following articles. The first shows one way to access columns by their unique name so you can traverse the DOM and get the control objects (see the second example). The second shows the general ways to access a control object from the DOM. The third shows how you can add a custom validator that can traverse the DOM and prevent cells from closing if there are issues, so you can combine this all in a better user experience.

 

 

Regards,

 

Marin Bratanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
General Discussions
Asked by
George
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or