How do you access the value of a BoundColumn in a DataGrid in VB.NET?
Posted on 2012-09-11
I'm trying to access the value of a BoundColumn in my datagrid and write an If statement around it in my Sub (VB.Net) called from a button. I'm just having trouble figuring out what syntax it wants. I've tried everything I can think of and everything Intellisense suggests.
The subroutine is called by a button that toggles between "Show All" and "Active Only". It works, but I just need to have it access the BoundColumn where the ID="Status". If the value is "Not Active" and the user just clicked "Active Only", it will turn the whole row to visible=false.
Sub showButtonSwitch(ByVal Source As Object, ByVal e As EventArgs)
If Me.ShowActiveOrAll.Text = "Show All" Then
' My Question is - How to write this If Statement:
'If the boundcolumn where id="Status" in the DataGrid Me.dg (where dg is a DataGrid ID) = "Not Active"
'Don't display the row
ShowActiveOrAll.Text = "Show All"
Me.dgOutput.Visible = True
ShowActiveOrAll.Text = "Active Only"