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

Button in GroupFooter

3 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Lever
Top achievements
Rank 1
James Lever asked on 02 Oct 2008, 01:58 PM
Hi guys/girls

i'm trying to put a button in the group footer in the code behind with the event item Databound
Code snippet
if(e.Item is GridGroupFooterItem) 
            { 
                var Footer = (GridGroupFooterItem) e.Item; 
 
                var button = new Button(); 
                button.Click += Button1_Click; 
                button.ID = "btnNext"
                button.CausesValidation = false
                button.UseSubmitBehavior = true
                button.Text = "Next"
 
                Footer.Cells[5].Controls.Add(button); 
            } 

but when i Click on the button it's posting back but not doing the Click Even ??
anyone know how to fix this
Thanks

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 02 Oct 2008, 02:19 PM
Hello James,

Please use ItemCreated to add controls/events. ItemDataBound will be called only during data-binding. If the grid child controls are recreated from ViewState the grid will not raise ItemDataBound.

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
James Lever
Top achievements
Rank 1
answered on 02 Oct 2008, 02:27 PM
is it possible to have a code snippet on how to do this
Thanks
0
Sebastian
Telerik team
answered on 02 Oct 2008, 02:46 PM
Hello James,

You can do that in the same manner as in the ItemDataBound event with your code snippet. Also consider using column unique names to identify the column cells instead of cell indices.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
James Lever
Top achievements
Rank 1
Answers by
Vlad
Telerik team
James Lever
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or