I am working on a gridview in netadvantage 5.3. I need to put an image in a cell to denote a certain instance in the record. How do I do that or can it be done with this control version? Please help and respond asap.
Thanks so much in advance.
usxpress said: I just figured out what it was... I had to take the For... Next out. The event rolls through each row so I didn't need to loop through it! DUH. Thanks for all your help and perspective! J
I just figured out what it was... I had to take the For... Next out. The event rolls through each row so I didn't need to loop through it! DUH.
Thanks for all your help and perspective!
J
Whoops, looks like I was a little late on my response! I'm glad you got it working.
The InitializeRow event is fired once for each row, so there really shouldn't be a need for the "For each e in UltraWebGrid1.Rows". I'm thinking if you take that line and the "Next" out, you should have it. I tried adding that logic to one of my grids and it didn't like it. Although I did get a slightly different error.
The other thing that has bitten me in the past is using the wrong column key name. I see some lines you reference by index and some by key. Personally, I prefer by key, but I do believe index is perfectly acceptable. If you are still having problems you could try switching them all to index.
Good luck!
Sorry for the delay in responding - working from home today with a sick child! Anyway, I took your advise and used the InitializeRow event and got the following... "System.InvalidCastException: Specified cast is not valid."
Here's what I wrote... the code craps out at the "Line 289: For Each e In UltraWebGrid1.Rows"
I have absolutely no idea what I'm doing wrong... it's probably looking right at me! I really appreciate all your help.
J______________________________________________________________________________________________________________________Code:
Dim img00 As String = "~/Images/Symbol Exclamation 1.png"
Dim img200 As String = "~/Images/phone-button-blue_16x16.png"
Dim img911 As String = "~/Images/phone-button-red_16x16.png"
'Dim x As String = e.Cells.FromKey("StatusNumber").Value
UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.ForeColor = Color.Transparent
UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.BackgroundImage = img00
UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.CustomRules = "Background-repeat:no-repeat"
UltraWebGrid1.Columns(0).Header.Style.CustomRules = "align:center"
UltraWebGrid1.Columns(0).CellStyle.HorizontalAlign = HorizontalAlign.Center
'row.Style.ForeColor = Color.Red
'row.Style.BackColor = Color.Yellow
e.Row.Cells(0).Style.BackgroundImage = img100
UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.BackgroundImage = img100
'UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.CustomRules = "Background-repeat:no-repeat"
' row.Style.ForeColor = Color.Red
' row.Style.BackColor = Color.Yellow
UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.ForeColor = Color.Transparent()
e.Row.Cells(0).Style.BackgroundImage = img200
'UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.BackgroundImage = img200
e.Row.Style.ForeColor = Color.Yellow
e.Row.Style.BackColor = Color.Black
UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.ForeColor = Color.Black()
e.Row.Cells(0).Style.BackgroundImage = img300
'UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.BackgroundImage = img300
e.Row.Style.ForeColor = Color.Red
e.Row.Style.BackColor = Color.Yellow
'UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.ForeColor = Color.Yellow()
'UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.IsEmpty()
UltraWebGrid1.Columns(0).CellStyle.ForeColor = Color.Transparent
e.Row.Cells(0).Style.BackgroundImage = img911
'UltraWebGrid1.Columns.FromKey("StatusNumber").CellStyle.BackgroundImage = img911
If e.Row.Cells.FromKey("Status").Value = "PRIORITY" Then
e.Row.Style.ForeColor = Color.LightBlue
e.row.Style.BackColor = Color.Navy
Next
Where are you calling that code? Have you tried it in the InitializeRow event? That event will be fired once for each row in the grid.