Client Side Get GridTemplateColumn/ItemTemplate

3 posts, 1 answers
  1. Josh Nielson
    Josh Nielson avatar
    11 posts
    Member since:
    May 2010

    Posted 20 May 2010 Link to this post

    Hello all,
    I have been trying to figure this out and I can't seem to find any documentation on it, and any functions that might just do what I need to accomplish it client side.

    scenario: I have a grid bound through  a web service, works great!
    in my grid I have a GridTemplateColumn

                                    <telerik:GridTemplateColumn HeaderText="Claiming" UniqueName="AmountToClaim"
                                            <ItemStyle CssClass="EclaimClaimAmount" /> 
                                            <HeaderStyle Width="75px" HorizontalAlign="center" /> 
                                            <ItemTemplate> 
                                                <asp:TextBox ID="Step3TitlesClaimAmountTextBox" EnableViewState="false" onKeyDown="return OnlyAllowNumbers(this);" 
                                                    runat="Server" CssClass="standardTextBoxClaimedAmount" onfocus="CalculateTotals('standardTextBoxClaimedAmount', 'textBoxStandardClaimedFooter')" 
                                                    onblur="CalculateTotals('standardTextBoxClaimedAmount', 'textBoxStandardClaimedFooter'); CheckBalance();"></asp:TextBox> 
                                            </ItemTemplate> 
                                            <FooterTemplate> 
                                                <span style="color: Yellow; font-weight: 600;">Total: </span> 
                                                <asp:TextBox ID="Step3TitlesClaimAmountFooterTextBox" EnableViewState="false" runat="server" 
                                                    CssClass="textBoxStandardClaimedFooter" BorderStyle="none" BackColor="#0075BD" 
                                                    ForeColor="white" Font-Bold="true"
                                                </asp:TextBox> 
                                            </FooterTemplate> 
                                        </telerik:GridTemplateColumn> 

    this is the javascript function I've come up with so far
        function ValidateMoney() { 
            var grid = $find("<%=Step3TitlesRadGrid.ClientID%>"); 
            var tableView = grid.get_masterTableView(); 
            var items = tableView.get_dataItems(); 
            for(var i = 0; i<items.length; i++){ 
                var rowValues = items[i].get_dataItem(); 
                if(rowValues.ApprovedAmount < ??how to get the text vale?? ){ 
                } 
            } 
        } 

    using javascript how would I loop through rows in this grid and get the value of each Step3TitlesClaimAmountTextBox

    Any help or pointers would be greatly appreciated 

    Thank you,
    Josh
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 May 2010 Link to this post

    Hello Josh,

    You can use use findElement method to access the TextBox control inside GridTemplateColumn. Give a try with this following code.

    Java Script:
    <script type="text/javascript"
    function ValidateMoney() {  
            var grid = $find("<%=Step3TitlesRadGrid.ClientID%>");  
            var tableView = grid.get_masterTableView();  
            var items = tableView.get_dataItems();  
            for(var i = 0; i<items.length; i++){  
                var rowValues = items[i]; 
                var Textvalue=rowValues.findElement("Step3TitlesClaimAmountTextBox").value;//access textbox value 
             }  
        }  
    </script> 

    Regards,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Josh Nielson
    Josh Nielson avatar
    11 posts
    Member since:
    May 2010

    Posted 24 May 2010 Link to this post

    That did the trick Thanks!
Back to Top