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

Forum statistics

Threads
474,002
Messages
2,570,257
Members
46,857
Latest member
ArleenWill

Latest Threads

Top