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

[Solved] Grid Controls inside EditFormTemplate

2 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SDI
Top achievements
Rank 1
SDI asked on 17 Aug 2013, 02:15 PM
I have a Parent grid that is editable with multiple controls in its <FormTemplate> and one of them is another Grid that is also editable. I cant seem to find the control inside the child Grid when it is in edit mode with JavaScript.

So i have a button that sets the date to another control in the child Grid. Function runs but cant even find the child Grid, therefore its controls.

function OnClientClickedSetDateToday(sender, args) {
var myGrid = $find('<%= RadGridMaster.ClientID%>').get_masterTableView().get_editItems()[0].findControl('RadGridSub');
}

 the variable myGrid is always NULL.Once it is found can i find the controls the same way?

function OnClientClickedSetDateToday(sender, args) {
 
// find the RadDateTimePicker inside the Child grid in the EditFormTemplate of the Parent Grid EditFormTemplate
var myRadDateTimePicker = $find('<%= RadGridMaster.ClientID%>').get_masterTableView().get_editItems()[0].findControl('RadGridSub').get_masterTableView().get_editItems()[0].findControl
('RadDateTimePickerTodayDate');
 
// need to set current date
var myTodayDate = new Date();
myRadDateTimePicker.set_selectedDate(myTodayDate);
 
}


code for Grids - need to find that RadDateTimePickerTodayDate control! Thanks!!!


<telerik:RadGrid runat="server" ID="RadGridMaster" Height="100%" Width="97%" AllowMultiRowSelection="false" AutoGenerateColumns="True" ShowHeader="False" AllowAutomaticUpdates="false" AllowAutomaticInserts="false">                               
<MasterTableView CommandItemDisplay="Top" NoMasterRecordsTex......
  <%-- Edit form parent template --%>
    <EditFormSettings EditFormType="Template">
    .........
<telerik:RadGrid runat="server" ID="RadGridSub">                                                   
         <MasterTableView CommandItemDisplay="Top" NoMasterRecordsT.......
                                    <EditFormSettings EditFormType="Template" ColumnNumber="2">
                                        <FormTemplate>
                                          .........
<telerik:RadButton runat="server" ID="RadButtonSetDateToday" OnClientClicked="OnClientClickedSetDateToday"....
<telerik:RadDateTimePicker runat="server" ID="RadDateTimePickerTodayDate" MinDate="1/1/190...






2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 19 Aug 2013, 05:52 AM
Hello,

Please try with the below link.
Access Another control which was in same level or in row

Thanks,
Jayesh Goyani
0
SDI
Top achievements
Rank 1
answered on 19 Aug 2013, 06:29 PM
resorted to setting a js variable to the raddatetimepicker on the client-load event for the dateinput property. in the click function we referenced the variable and set the date to date desired.
Tags
Grid
Asked by
SDI
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
SDI
Top achievements
Rank 1
Share this question
or