Xavier Soares
Top achievements
Rank 2
Xavier Soares
asked on 21 Aug 2008, 02:11 PM
Hello,
Is it possible to add a column to a radgridview, that corresponds to a another specific column value?
For instance, if a value in column A is greater than 10, in column B, I want to show an exclamation point or an image that corresponds to that condition. I want to create a grid like the outlook messages list (using exclamation points, envelops, etc.)
I'm using the conditional formating but, as long as I know, I can only apply row/cell color formating.
Thank You.
LM
Is it possible to add a column to a radgridview, that corresponds to a another specific column value?
For instance, if a value in column A is greater than 10, in column B, I want to show an exclamation point or an image that corresponds to that condition. I want to create a grid like the outlook messages list (using exclamation points, envelops, etc.)
I'm using the conditional formating but, as long as I know, I can only apply row/cell color formating.
Thank You.
LM
4 Answers, 1 is accepted
0
Hi Luis,
Thank you for this question.
Yes, this is possible. I suggest you using the CellFormatting event. This event is fired every time when a cell needs to change its visual state. Check the code snipped below:
I hope this helps. Please let me know if you have other questions.
Regards,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for this question.
Yes, this is possible. I suggest you using the CellFormatting event. This event is fired every time when a cell needs to change its visual state. Check the code snipped below:
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) |
{ |
if (e.CellElement is GridImageCellElement) |
{ |
if ((int)e.CellElement.RowInfo.Cells["Value"].Value > 2) |
{ |
e.CellElement.Image = Resources.red; |
} |
else |
{ |
e.CellElement.Image = Resources.green; |
} |
} |
} |
I hope this helps. Please let me know if you have other questions.
Regards,
Jack
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Xavier Soares
Top achievements
Rank 2
answered on 22 Aug 2008, 04:58 PM
Thank You!
I changed a few things but it worked|.
Thanks.
LM
I changed a few things but it worked|.
Thanks.
LM
0
Xavier Soares
Top achievements
Rank 2
answered on 25 Aug 2008, 09:42 AM
Hello,
I'm having problems applying a backcolor to a cell when using the following code:
I'm having problems applying a backcolor to a cell when using the following code:
Private Sub RadGridProposals_CellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridProposals.CellFormatting
Select e.CellElement.ColumnIndex
Case 9
If Convert.ToInt32(e.CellElement.RowInfo.Cells("Approved").Value) = 1 Then
e.CellElement.Image =
My.Resources.Order_16x16
End If
Case 10
If Convert.ToInt32(e.CellElement.RowInfo.Cells("Approved").Value) = 1 Then
e.CellElement.BackColor = Color.FromArgb(194, 214, 155)
End If
End Select
End Sub
I cant apply a color to text but not the cell backcolor. Is it possible to do so?
Thank Your for your help.
LM
0
Hi Luis,
In order to visualize the back color of a CellElement, you should set its DrawFill to True:
If you have additional questions, feel free to contact me.
Sincerely yours,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
In order to visualize the back color of a CellElement, you should set its DrawFill to True:
e.CellElement.DrawFill = True |
If you have additional questions, feel free to contact me.
Sincerely yours,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.