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

Finding the footertemplate control

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
thdwlgP
Top achievements
Rank 1
thdwlgP asked on 08 Apr 2010, 07:11 PM
I have a column with a footer that has a label
I also have a button in the commanditemtemplate that has a onClick event which updates the values in the RadNumericTextbox and need to sum the total in the uxTotalAdjustedProfit label.
How do I access that control? I tried uxRadGrid.MasterTableView.FindControl (didnt work...) or there is no get footercontrol etc...

                        <telerik:GridTemplateColumn AllowFiltering="False" Groupable="False" HeaderText="Adjusted Profit" 
                            UniqueName="AdjustedProfit">  
                            <ItemTemplate> 
                                <telerik:RadNumericTextBox ID="uxAdjustedProfit" runat="server" MaxLength="6" MinValue="0" Enabled="false" 
                                    Width="45px" Font-Size="11px" ForeColor="#773A0D" Value='<%# Convert.ToInt32(Eval("Quantity")) * Convert.ToDecimal(Eval("AdjustedProfit")) %>'>  
                                </telerik:RadNumericTextBox> 
                            </ItemTemplate> 
                            <FooterTemplate> 
                                <b> 
                                    <asp:Label ID="uxTotalAdjustedProfit" runat="server"></asp:Label></b>  
                            </FooterTemplate> 
                        </telerik:GridTemplateColumn> 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 09 Apr 2010, 07:03 AM
Hello,

You can access the Label placed in FooterTemplate by using following code.

C#:
 
GridFooterItem fitem = (GridFooterItem)RadGrid1.MasterTableView.GetItems(GridItemType.Footer)[0]; 
Label lb = (Label)fitem.FindControl("Label1"); 
string val = lb.Text; 
// Set the Label Text here 

regards,
Shinu.
Tags
Grid
Asked by
thdwlgP
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or