Help in converting C# to VB

G

Guest

Can anyone help in converting the code below to VB.NEt!
Thx
protected void myDataGrid_OnItemDataBound(object sender,
DataGridItemEventArgs e)
{

if(e.Item.FindControl("DeleteLink") != null)
{
((LinkButton)
e.Item.FindControl("DeleteLink")).Attributes.Add("onClick", "return
confirm('Are you sure you wish to delete this item?');");

}
}
 
J

Jos

Patrick.O.Ige said:
Can anyone help in converting the code below to VB.NEt!
Thx
protected void myDataGrid_OnItemDataBound(object sender,
DataGridItemEventArgs e)
{

if(e.Item.FindControl("DeleteLink") != null)
{
((LinkButton)
e.Item.FindControl("DeleteLink")).Attributes.Add("onClick", "return
confirm('Are you sure you wish to delete this item?');");

}
}

Here's a converter:
http://authors.aspalliance.com/aldotnet/examples/translate.aspx

In your example though, it has problems with the confirm
statement.
To work around this, replace the "return confirm();" with an
empty string, and put it back after translation.
 
C

Craig

Private Sub myDataGrid_ItemDataBound(ByVal sender As System.Object, ByVal e
As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
TheGrid.ItemDataBound
If (Not e.Item.FindControl("DeleteLink") Is Nothing) Then
DirectCast(e.Item.FindControl("DeleteLink"),
LinkButton).Attributes.Add("onclick", "return confirm('Are you sure you wish
to delete this item?');")
End If
End Sub

HTH
Craig
 

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,001
Messages
2,570,255
Members
46,853
Latest member
GeorgiaSta

Latest Threads

Top