clientside find control inside radgrid

3 posts, 1 answers
  1. Emre
    Emre avatar
    1 posts
    Member since:
    May 2012

    Posted 05 Jul 2012 Link to this post

      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"
                                      <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                                       <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"
                         <MasterTableView DataSourceID="SqlDataSourceAlimKalemiGrid" AutoGenerateColumns="False" DataKeyNames="id" AllowAutomaticUpdates="false" AllowAutomaticInserts="false">
           <EditFormSettings EditFormType="Template">
                   <EditColumn FilterControlAltText="Filter EditCommandColumn column" UniqueName="EditCommandColumn1">
                      <telerik:RadScriptBlock ID="alimekalemirad" runat="server">
              <script type="text/javascript">
                  function OnClientValueChanged(sender, args) {
                     //in here I want to find RadTextBoxAdet and RadNumericTextBoxBirimFiyat 

                             <telerik:RadTextBox ID="RadTextBoxAdet" runat="server" EmptyMessage="Adet"
                                     InputType="Number" LabelCssClass="" LabelWidth="64px" Width="80px">
                                    <ClientEvents OnValueChanged="OnClientValueChanged" />
                                 <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 ID="RadNumericTextBoxToplam" runat="server"
                                     Culture="tr-TR" LabelCssClass="" LabelWidth="64px" Type="Currency"
                                     Width="100px" ReadOnly="True" Skin="Windows7">
                                     <NumberFormat ZeroPattern="n TL" />
                                 <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:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"
                                   HeaderText="Projelerini Göster" UniqueName="TemplateColumn">
                                       <a class="gridinserthref" href="#" onclick="return showradwindow('alim_kalemi_degistir');"
                               style="color: Red;">Yeni Kayıt Ekle +</a>
                         <FilterMenu EnableImageSprites="False">
    Any help is appreciated,thanks.
  2. Answer
    Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 05 Jul 2012 Link to this post


    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);


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

    Jayesh Goyani
  3. DevCraft R3 2016 release webinar banner
  4. amy
    amy avatar
    1 posts
    Member since:
    Sep 2016

    Posted 19 Sep in reply to Jayesh Goyani Link to this post


    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.


Back to Top