Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
745
FooterTemplate problem
posted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Hi,
I have this webdatagrid, with a column "Estado". I applied a footer that contains a template.

In the code behind, after the databinding, if I try to access the button inside my FooterTemplate:

CType(wdgVendasVendedor.Columns.Item("Estado").Footer.FindControl("lbtnEstadoFooter"), Button).CssClass = "CmdDash"

It gives me an exception, because FindControl returns "Nothing".
How can I access the button inside my FooterTemplate at runtime?

Below is the gatagrid. Thank you.

<

 

 

ig:WebDataGrid ID="webDataGrid1" runat="server" AutoGenerateColumns="False" Width="100%" Height="200px" ShowFooter="True" EnableDataViewState="True" Visible="False">
   <Columns>
      
<ig:TemplateDataField Key="Estado" Width="16px" Header-Text="" Header-Tooltip="Alerta sobre o Desvio de Vendas">
          
<ItemTemplate>
               
<asp:Button ID="lbtnEstado" runat="server" Height="16px"></asp:Button>
          
</ItemTemplate>
          
<FooterTemplate>
               
<asp:Button ID="lbtnEstadoFooter" runat="server" Height="16px" CssClass="CmdVerdeDash"></asp:Button>
           </FooterTemplate>
       
</ig:TemplateDataField>
.......

 

 

 

 

 

 

 

 

 

 

 

 

</

 

 

Columns>
<Behaviors>
    
<ig:Selection RowSelectType="Single" Enabled="True" CellClickAction="Row"></ig:Selection>
<ig:ColumnResizing Enabled="false"></ig:ColumnResizing>
<ig:Filtering Alignment="Top" Visibility="Visible" Enabled="true" AnimationEnabled="false" />
</Behaviors>
</ig:WebDataGrid>

Parents
  • 49378
    Suggested Answer
    posted

    Hi Sonia,

    You can access the control templated in your footer by accesing the TemplateContainer. For instance:


    ((
    Button)WebDataGrid1.Columns[3].Footer.TemplateContainer.FindControl("myButton")).CssClass = "myButtonClass";

    Please note that the grid has to be data bound before accessing the templated controls.

    Hope this helps.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://es.infragistics.com/support

     

Reply Children