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

How to set_selectedDate to radDatetimepicker in radgrid

2 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkat
Top achievements
Rank 1
Venkat asked on 03 Jul 2012, 10:22 AM
hi all ..
i have raddatetimepicker in radgrid i want to set selected date to raddatetimepicker on OnClientTimeSelecting this event

<telerik:RadGrid ID="radGrid_Attendance" Width="938" runat="server" AutoGenerateColumns="false"<br>
OnItemDataBound="radGrid_Attendance_ItemDataBound" <br>
onitemcommand="radGrid_Attendance_ItemCommand" <br>
oninsertcommand="radGrid_Attendance_InsertCommand"><br>
<MasterTableView CommandItemDisplay="Top" EditMode="PopUp" Width="938"><br>
<Columns><br>
<telerik:GridTemplateColumn HeaderStyle-Width="190" HeaderText="Login." ItemStyle-Width="190"><br>
  
<ItemTemplate><br>
  
<telerik:RadDateTimePicker ID="raddtp_LoginTime" DateInput-DateFormat="MMM dd yyyy hh:mm tt"<br>
  
runat="server" TimeView-Columns="4" TimeView-Interval="00:30:00" Width="99%"><br>
<ClientEvents OnDateSelected="raddtp_LoginTime_OnDateSelected" /><br>
<TimeView runat="server" ID="TimeView1" OnClientTimeSelecting="ClientTimeSelecting" ></TimeView><br>
</telerik:RadDateTimePicker><br>
</ItemTemplate><br>
</telerik:GridTemplateColumn><br>
</Columns><br>
 </telerik:RadGrid>



On databinding completed
grid have 10 rows..
i want to set selected date to particular datetimepicker...
plz help me...

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 06 Jul 2012, 10:41 AM
Hi Venkat,

You could access any picker in the template column. For example if you want to get the picker in the first row of the grid, please try:
Copy Code
var firstRow = $find("<%=RadGrid1.ClientID%>").get_masterTableView().get_dataItems()[0];
var firstPicker = firstRow.findControl("RadDatePicker1");
firstPicker.get_popupButton().click();

That should do the trick.

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Venkat
Top achievements
Rank 1
answered on 06 Jul 2012, 12:41 PM
HI... Eyup.. thanks alot...
i got it with this code
function ClientTimeSelecting(sender, args) {
                if (args.get_oldTime() == null) {
                    var id1 = $find(sender.get_id());
                    var datetimepicker = $find(id1._ownerDatePickerID);
                    datetimepicker.set_selectedDate(new Date($get('<%=HiddenField1.ClientID %>').value));
                }
            }
Tags
Grid
Asked by
Venkat
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Venkat
Top achievements
Rank 1
Share this question
or