I want to display an image in a WebGrid Column if the column value is true (it is a boolean column). Does anyone have any sample code to accomplish this? I am doing strictly code behind for this Grid and bypassing the Designer (smarttag)...
I am really close now. I have it all figured out except for getting the image to center in the cell...
I have tried:
UWGCaseCalls.DisplayLayout.Bands(0).Columns(15).CellStyle.CustomRules = "align:center"
AND
UWGCaseCalls.DisplayLayout.Bands(0).Columns(15).CellStyle.HorizontalAlign = HorizontalAlign.Center
Any ideas?
I am still having a bit of a problem.
I am really close to a solution using the code below. The problem I am having is:
1. Hiding the check box that is generated for the boolean column when the flag is shown. Actually, that checkbox can be suppressed by default even when the flag isn't shown.2. Making the background image center in the cell and not repeat like wallpaper.
Private Sub UWGCaseCalls_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles UWGCaseCalls.InitializeRow
If e.Row.Cells(15).Value = True Then
e.Row.Cells(15).Style.BackgroundImage = "~/images/flag.jpg"
End
End Sub
'UWGCaseCalls_InitializeRow
I guess I should have searched a little more.
I found a good solution here:
http://forums.infragistics.com/forums/p/3847/19632.aspx#19632