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

clientside find control inside radgrid

3 Answers 372 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Emre
Top achievements
Rank 1
Emre asked on 05 Jul 2012, 12:10 PM
  I want to find 2 radtextbox in clientside that is inside a radgrid ,and radgrid is inside a radlistview.But all examples on internet are for one root radgrid,so I need an example in which I can find the textboxes on clientside and use them for calculations.If the radtextboxes are in root page,i can use this easily,
function OnClientValueChanged(sender, args) {
 
               var tx_adet = $find("<%= RadTextBoxAdet.ClientID %>");
               var tx_birim = $find("<%= RadNumericTextBoxBirimFiyat.ClientID %>");
               var labeltoplam = $find("<%= RadNumericTextBoxToplam.ClientID %>");
               labeltoplam.set_value(tx_adet.get_value() * tx_birim.get_value());
             
           }

But in my scenario,these textboxes are inside 2 data components,root listview and inside listview a radgrid.

<telerik:RadListView ID="RadListView1" runat="server"
                              DataSourceID="SqlDataSourceAlimKalemiKategori0"
                              onitemdatabound="RadListView1_ItemDataBound">
                              <LayoutTemplate>
                                  <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                              </LayoutTemplate>
                              <ItemTemplate>
                                   <asp:HiddenField ID="HiddenFieldid" runat="server" Value='<%# Eval("id") %>'/>
                  <h2>    <%# Eval("ad") %></h2>
           <telerik:RadGrid ID="RadGrid_alimedetaylar" runat="server"
                                       CellSpacing="0"  ShowFooter="true" AllowAutomaticUpdates="false" AllowAutomaticInserts="false"
                     DataSourceID="SqlDataSourceAlimKalemiGrid" GridLines="None" Culture="tr-TR"
                     OnItemCommand="RadGrid_alimedetaylar_ItemCommand"
                               onitemdatabound="RadGrid_alimedetaylar_ItemDataBound">
                     <MasterTableView DataSourceID="SqlDataSourceAlimKalemiGrid" AutoGenerateColumns="False" DataKeyNames="id" AllowAutomaticUpdates="false" AllowAutomaticInserts="false">
       <EditFormSettings EditFormType="Template">
               <EditColumn FilterControlAltText="Filter EditCommandColumn column" UniqueName="EditCommandColumn1">
               </EditColumn>
               <FormTemplate>
                  <telerik:RadScriptBlock ID="alimekalemirad" runat="server">
    
          <script type="text/javascript">
              function OnClientValueChanged(sender, args) {
                 //in here I want to find RadTextBoxAdet and RadNumericTextBoxBirimFiyat 

              
                  
              }
     </script>
     </telerik:RadScriptBlock>
                         <telerik:RadTextBox ID="RadTextBoxAdet" runat="server" EmptyMessage="Adet"
                                 InputType="Number" LabelCssClass="" LabelWidth="64px" Width="80px">
                                <ClientEvents OnValueChanged="OnClientValueChanged" />
                             </telerik:RadTextBox>
                         </td>
                         <td>
                             <telerik:RadNumericTextBox ID="RadNumericTextBoxBirimFiyat" runat="server"
                                 Culture="tr-TR" LabelCssClass="" LabelWidth="40px"
                                 Type="Currency" Width="100px" EmptyMessage="Birim Fiyat">
                                 <NumberFormat ZeroPattern="n TL" />
                                     <ClientEvents OnValueChanged="OnClientValueChanged" />
                             </telerik:RadNumericTextBox>
                         </td>
                         <td>
                             <telerik:RadNumericTextBox ID="RadNumericTextBoxToplam" runat="server"
                                 Culture="tr-TR" LabelCssClass="" LabelWidth="64px" Type="Currency"
                                 Width="100px" ReadOnly="True" Skin="Windows7">
                                 <NumberFormat ZeroPattern="n TL" />
                             </telerik:RadNumericTextBox>
               </FormTemplate>
           </EditFormSettings>
                        
                       
                         <Columns>
                           
                           
                             <telerik:GridBoundColumn DataField="toplam_fiyat" DataType="System.Decimal"
                                 FilterControlAltText="Filter toplam_fiyat column" HeaderText="Toplam Fiyat" FooterAggregateFormatString="{0:c}" Aggregate="Sum"  FooterText="Total: "
                                 SortExpression="toplam_fiyat" UniqueName="toplam_fiyat">
                             </telerik:GridBoundColumn>
                               
                     <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"
                               HeaderText="Projelerini Göster" UniqueName="TemplateColumn">
                               <ItemTemplate>
                                   <a class="gridinserthref" href="#" onclick="return showradwindow('alim_kalemi_degistir');"
                           style="color: Red;">Yeni Kayıt Ekle +</a>
                                   </ItemTemplate>
                           </telerik:GridTemplateColumn>
                         </Columns>
                
                             
                     </MasterTableView>
                      
                     <FilterMenu EnableImageSprites="False">
                     </FilterMenu>
                 </telerik:RadGrid>
                      
                              </ItemTemplate>
                          </telerik:RadListView>
Any help is appreciated,thanks.

3 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 05 Jul 2012, 12:50 PM
Hello,


function OnClientValueChanged(sender, args) {
               // Do not forget to add jquery in reference
               var SenderId = sender.get_element().id; // sender.get_id();
               var RadTextBoxAdet = $("#" + SenderId).get(0);
               var RadNumericTextBoxBirimFiyat = $("#" + SenderId.replace("RadTextBoxAdet", "RadNumericTextBoxBirimFiyat")).get(0);
 
           }

OR

How to access the control from itemtemplate in Radgrid on client side

Thanks,
Jayesh Goyani
0
amy
Top achievements
Rank 1
answered on 19 Sep 2016, 06:47 PM

Hi,

I tried this code to find the value of the raddatepicker(selected date) and it worked fine. But I have a problem while I'm trying to display the selected date in another raddatepicker control. Could you please help me.

Thanks in advance.

 

0
TUSHAR
Top achievements
Rank 1
answered on 27 Feb 2018, 12:50 PM

Hi Jayesh !!!!

 

Can you help me out how to find the control of Telerik nested grid  in javascript
 In jquery we caneasily find the control like this

  var ordersViewCoverage = $telerik.findControl(nestedViewItem, "RadGrid3").get_masterTableView();

Tags
Grid
Asked by
Emre
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
amy
Top achievements
Rank 1
TUSHAR
Top achievements
Rank 1
Share this question
or