mercredi 24 juin 2015

Make If Statments Using Gridview LinkButtons

I have 2 Linkbuttons inside each row of my gridview. I want to know how I can use If statements to determine which changes should be made.

My current If statements(which I know are wrong) are as follows:

If LinkButton1.Text = "Update" Then

    Dim row As GridViewRow = DisplayClassifieds.SelectedRow
    strFilter = row.Cells(1).Text

    strSelect = "SELECT Classid, Addate, Category, Username, Phonenbr, Email, Description, Fulldescription FROM TABLENAME WHERE Classid = '" & strFilter & "' "

        Page.Session.Add("Admin_Updates", strSelect)
        Response.Redirect("DispAd.aspx")

ElseIf LinkButton2.Text = "Delete" Then

    Dim ClassifiedStr As New OleDbCommand

        ClassifiedStr.CommandType = CommandType.StoredProcedure
        ClassifiedStr.CommandText = "delete_classifieds"
        ClassifiedStr.Connection = conn

        'Must be organized based on Stored Procedure
        ClassifiedStr.Parameters.Add("val_id", OleDbType.Date).Value = strFilter
        conn.Open()

        ClassifiedStr.ExecuteNonQuery()
        conn.Close()
        Response.AddHeader("Refresh", "1")

End if

What do I use in place of my lines If LinkButton1.Text = "Update"

enter image description here

Aucun commentaire:

Enregistrer un commentaire