Protected Sub myGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles myGridView.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'*** ProductID ***'
Dim lblProductID As Label = DirectCast(e.Row.FindControl("lblProductID"), Label)
If Not IsNothing(lblProductID) Then
lblProductID.Text = e.Row.DataItem("ProductID")
End If
Dim dt As DataTable = getProductDet(e.Row.DataItem("ProductID"))
'*** ProductName ***'
Dim lblProductName As Label = DirectCast(e.Row.FindControl("lblProductName"), Label)
If Not IsNothing(lblProductName) Then
lblProductName.Text = dt.Rows(0)("ProductName")
End If
'*** Delete ***'
Dim lnkDelete As LinkButton = DirectCast(e.Row.FindControl("lnkDelete"), LinkButton)
If Not IsNothing(lnkDelete) Then
lnkDelete.Text = "Delete"
lnkDelete.CommandName = "Del"
lnkDelete.CommandArgument = e.Row.RowIndex
lnkDelete.Attributes.Add("OnClick", "return confirm('Delete this row?');")
End If
End If
End Sub