I need to execute a sql statement based on the boolean value in the column, ExemptSuperviors, however the value is not being written to the grid. Hence, I am not getting the value for the sql statement. How can I resolve this issue, please.
Even the boolean value cannot be displayed, I do need it for the sql statement.
I have:
' ExemptSupervior
.Columns.Add(New Infragistics.WebUI.UltraWebGrid.UltraGridColumn)
With .Columns(.Columns.Count - 1).Hidden = False.Header.Caption = "ExemptSupervior".Width = 25.IsBound = True.BaseColumnName = "ExemptSupervior".Key = "ExemptSupervior"End With
Along with:If e.Row.Cells(e.Row.Cells.IndexOf("ExemptSupervisor")).Value = "-1" Then <= Level of error
If (e.Row.Cells(e.Row.Cells.IndexOf("LunchTime")).Value = "3") Then do some stuff Else If (e.Row.Cells(e.Row.Cells.IndexOf("LunchTime")).Value = "6") Then do some other stuff End
I'm assuming that your "ExemptSupervisor" column becomes a Boolean value in your data source, which is likely why it's appearing as a checkbox. Assuming that this is the case, then you simply need to cast the value of your cell from an Object to a Boolean:
If CType(e.Row.Cells.FromKey("ExemptSupervisor").Value, Boolean) = False Then '<= Level of error
By the way, if you need your column to be stored in ViewState, I also suggest you add it to your grid in a different manner, as illustrated here:
' ExemptSupervior Dim colExempt As New Infragistics.WebUI.UltraWebGrid.UltraGridColumn(True).columns.Add(colExempt)With colExempt.Hidden = False.Header.Caption = "ExemptSupervior".Width = 25.IsBound = True.BaseColumnName = "ExemptSupervior".Key = "ExemptSupervior"End With
"ExemptSupervisor" is a boolean value in the database but nothing is appearing on the web grid, not a checkbox, simply an empty space. I did make the changes you suggested and again, no value is being written to the grid.
Using: If CType(e.Row.Cells.FromKey("ExemptSupervisor").Value, Boolean) = False Then I get the following error message: Object reference not set to an instance of an object
1> How do I write the Boolean value to the grid?2> How do I then capture the value to use it the the "If/Else/End" statement?
Thank you.