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

Retriving FooterTemplate Items in Javascript

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wai Wai Chan
Top achievements
Rank 1
Wai Wai Chan asked on 13 Sep 2010, 10:09 AM
Hi There,

Below is my sample code of a GridTemplateColumn in RadGrid1.
To be noted that there are 2 labels, for displaying MYR and USD amounts respectively, in the footer.
<telerik:GridTemplateColumn UniqueName="Balance" HeaderText="Balance">
    <ItemTemplate>
        <asp:Label ID="lblBalance" runat="Server"></asp:Label>
    </ItemTemplate>
    <FooterTemplate>
        <asp:Label ID="lblBalanceMYR" runat="Server"></asp:Label
        <asp:Label ID="lblBalanceUSD" runat="server"></asp:Label>
    </FooterTemplate>
</telerik:GridTemplateColumn>

I try to use below javascript to retrieve the MYR amount for further client-side validation. Unfortunately the program always throws me the USD amount, a.k.a. the inner text of "lblBalanceUSD" only, instead of "lblBalanceMYR".
var Amount = RadGrid1.get_masterTableView().get_element().tFoot.all.tags("span")[0].innerHTML;

Any idea to access the text of "lblBalanceMYR"?
Thanks in advance. :)

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Sep 2010, 12:14 PM
 Hello Wai,

You can access the footer text of  label(lblBalanceMYR) by specifying the index position like below.

ClientCode:
<script type="text/javascript">
function check()
{
var rdgrid= $find('<%=RadGrid1.ClientID %>');
var Amount1 = rdgrid.get_masterTableView().get_element().tFoot.all.tags("span")[0].innerHTML;
var amount=rdgrid.get_masterTableView().get_element().tFoot.all.tags("span")[1].innerText
}
</script>

Regards,
Shinu.
Tags
Grid
Asked by
Wai Wai Chan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or