rito1
asked on
Specifying Gridview Row Cells
Hi All,
Say I have the following RowDataBound event..
Rather than specifying the cell using it's ordinal value is there a more specific way that won't mean that I need to check/ update this event every time a new column is added to the Gridview control?
Many thanks,
Rit
Say I have the following RowDataBound event..
Rather than specifying the cell using it's ordinal value is there a more specific way that won't mean that I need to check/ update this event every time a new column is added to the Gridview control?
Many thanks,
Rit
Sub ProductGridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim myQty as Integer = CInt(e.Row.Cells(1).Text)
If myQty > 0 then
e.Row.Cells(3).Text = "In Stock"
Else
e.Row.Cells(3).Text = "Not In Stock"
End If
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks both,
prairiedog, this is exactly what I was looking for.
Rit
prairiedog, this is exactly what I was looking for.
Rit
One part I have tried to keep in VB.Net which was copied from yours.
Open in new window