I'm using this code to pop-up a message box. The problem is that it doesn't work on the first click, it has to be clicked twice and thats for each row in the datagrid. Then it is fine. Any suggestions?


Dim btnDelete As Button
btnDelete = e.Item.Cells(4).Controls(0) '<---2nd column, first control
btnDelete.Attributes.Add("onclick", "return confirm('Are you Sure you want to delete this row?');")