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>
Hi Sonia,
Please do not hesitate to contact me if you need further assistance.
Best Regards,Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://ko.infragistics.com/support
Yes it works! :D
Thanks
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 IvanovDeveloper Support EngineerInfragistics, Inc.http://ko.infragistics.com/support