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

How to set the date for datepicker in RowCreated Clientside event ?

1 Answer 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bibhudutta
Top achievements
Rank 1
Bibhudutta asked on 17 Apr 2013, 01:25 PM
Hi,

I have a rad grid in which I have a column which is a template column and this column is always in edit mode.
The template column has a rad Date Picker. I want to set the rad date picker date in the RowCreated Client side event of the rad grid.

<telerik:GridTemplateColumn UniqueName="CustomerStartDate" HeaderText="Customer Start Date"
    DataField="CustomerStartDate" HeaderStyle-Width="80px" SortExpression="CustomerStartDate">
    <ItemTemplate>
            <telerik:RadDatePicker ID="radDatePickerCustomerStartDate" runat="server" DbSelectedDate='<%# Bind("CustomerStartDate") %>'
            ShowPopupOnFocus="true" DateInput-DateFormat="MM/dd/yyyy">
            <ClientEvents OnDateSelected="radDatePickerCustomerStartDate_OnDateSelected"></ClientEvents>
        </telerik:RadDatePicker>
    </ItemTemplate>
</telerik:GridTemplateColumn>

I have tried with this but its unable to do so,

var date = new Date();
args.get_gridDataItem().findControl(
'radDatePickerCustomerStartDate').get_element().set_selectedDate(date);

Please help me out. I need to do it in the RowCreated event handler on client side.

1 Answer, 1 is accepted

Sort by
0
Bibhudutta
Top achievements
Rank 1
answered on 18 Apr 2013, 08:19 AM
I solved it in this way,

function rgCustomerAddress_RowCreated(sender, args) {
var date = new Date();
document.getElementById(args.get_gridDataItem().findControl('radDatePickerCustomerStartDate').get_element().id + '_dateInput').value = date;
}
Tags
Grid
Asked by
Bibhudutta
Top achievements
Rank 1
Answers by
Bibhudutta
Top achievements
Rank 1
Share this question
or