is this the right way in vb?

G

Guest

This works, i adds a confirm box to a datagrid control. However is this the
correct way to check for the an item or alt item in the onitemdatabound
event/sub?

Private Sub dgOrders_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgOrders.ItemDataBound
If e.Item.ItemIndex <> -1 Then
Dim thslnkBtn As LinkButton
thslnkBtn = e.Item.FindControl("delThis")
thslnkBtn.Attributes.Add("onClick", "return confirm('Are you
sure you wish to delete this item?');")
End If
End Sub
or should it be done like the C# way "if(e.Item.FindControl("DeleteLink") !=
null))".
If so how?
thanks
kes

(i like the C# way better:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top