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

Client Side Get GridTemplateColumn/ItemTemplate

2 Answers 280 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 20 May 2010, 11:21 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 May 2010, 05:37 AM
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.
0
Josh
Top achievements
Rank 1
answered on 24 May 2010, 04:58 PM
That did the trick Thanks!
Tags
Grid
Asked by
Josh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Josh
Top achievements
Rank 1
Share this question
or