Help in converting C# to VB

Discussion in 'ASP .Net' started by Guest, Oct 4, 2004.

  1. Guest

    Guest 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?');");

    }
    }
     
    Guest, Oct 4, 2004
    #1
    1. Advertisements

  2. Guest

    Jos Guest

    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.
     
    Jos, Oct 4, 2004
    #2
    1. Advertisements

  3. Guest

    Craig Guest

    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
     
    Craig, Oct 4, 2004
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.