Avatar of 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,

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"
		e.Row.Cells(3).Text = "Not In Stock"
	End If 
    End If
End Sub

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon