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

Dynamic Button Click?

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 22 Dec 2008, 06:24 PM
ItemDataBound I create a button if the status is pending and past 10 days...I assign the click event handler to it, but it doesn't seem to fire

                              
                                    //If Date.Now is at least 10 days past the notification date
                                    if (DateTime.Now > DateTime.Parse(item.Cells[8].Text).AddDays(10))
                                    {
                                        TableCell cell = new TableCell();
                                        Button notifyButton = new Button();
                                        notifyButton.Text = "Re-send Notificaiton";
                                        notifyButton.Click += new EventHandler(notifyButton_Click);
                                        cell.Controls.Add(notifyButton);
                                        item.Cells.Add(cell);
                                    }

Any idea what should I be doing to get it to fire?
                               

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 23 Dec 2008, 04:31 AM
Hi Steve,

Try creating the button in the ItemCreated event and see if the button click event is getting fired.
Distinguishing the major differences between ItemCreated and ItemDataBound events

Shinu
Tags
Grid
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Shinu
Top achievements
Rank 2
Share this question
or