01.
Protected
Sub
myGridView_RowDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
System.Web.UI.WebControls.GridViewRowEventArgs)
Handles
myGridView.RowDataBound
02.
03.
If
e.Row.RowType = DataControlRowType.DataRow
Then
04.
05.
06.
Dim
lblProductID
As
Label =
DirectCast
(e.Row.FindControl(
"lblProductID"
), Label)
07.
If
Not
IsNothing(lblProductID)
Then
08.
lblProductID.Text = e.Row.DataItem(
"ProductID"
)
09.
End
If
10.
11.
Dim
dt
As
DataTable = getProductDet(e.Row.DataItem(
"ProductID"
))
12.
13.
14.
Dim
lblProductName
As
Label =
DirectCast
(e.Row.FindControl(
"lblProductName"
), Label)
15.
If
Not
IsNothing(lblProductName)
Then
16.
lblProductName.Text = dt.Rows(0)(
"ProductName"
)
17.
End
If
18.
19.
20.
Dim
lnkDelete
As
LinkButton =
DirectCast
(e.Row.FindControl(
"lnkDelete"
), LinkButton)
21.
If
Not
IsNothing(lnkDelete)
Then
22.
lnkDelete.Text =
"Delete"
23.
lnkDelete.CommandName =
"Del"
24.
lnkDelete.CommandArgument = e.Row.RowIndex
25.
lnkDelete.Attributes.Add(
"OnClick"
,
"return confirm('Delete this row?');"
)
26.
End
If
27.
28.
End
If
29.
30.
End
Sub