TBMH
Posts: 40
|
| Posted: 03/25/2007, 12:38 PM |
|
I'd like to change the background color of a grid row based on some database value. For example, perhaps I would like to change the row to red if a PRIORITY = HIGH.
Are the any sample of this? Or, can someone provide some advice on how to do this?
Thanks,
Scott
|
 |
 |
TBMH
Posts: 40
|
| Posted: 03/27/2007, 5:47 PM |
|
Soooo.......I'm guessing this either isn't possible, or isn't easy.
Is this correct?
|
 |
 |
wkempees
|
| Posted: 03/28/2007, 12:55 AM |
|
It is explained in CCS3.1 Help, search for Component Attribute.
Basically you switch to HTML view, find the <TD> or <TR> for the row.
add a Label from the Forms Tab.
From then on in your BeforeShowRow, you can set the label to any <stle. or
{color:} value.
remember to initially set it to the default value and then conditionally set
it to the desired value.
Walter
"TBMH" <TBMH@forum.codecharge> schreef in bericht
news:24606ddd575efe@news.codecharge.com...
> I'd like to change the background color of a grid row based on some
> database
> value. For example, perhaps I would like to change the row to red if a
> PRIORITY
> = HIGH.
>
> Are the any sample of this? Or, can someone provide some advice on how to
> do
> this?
>
> Thanks,
> Scott
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
gregm
Posts: 21
|
| Posted: 03/28/2007, 1:27 AM |
|
Yes this is easy enough.
a) Highlight the grid in the project explorer to make it the active component.
b) In the properties highlight the Before Show Row event.
c) At the top of the properties box, click the + and Select Add Code
In this event you can made conditional decisions against the data, for example and given a field name of "STATUS"
If DataItem.rawdata("STATUS") = "Open" Then
Dim MyLabel1 As System.Web.UI.WebControls.Literal = DirectCast(e.Item.FindControl("vwSSEmpReqLabel1"),System.Web.UI.WebControls.Literal)
MyLabel1.Text=" <b> <font color='red'> "
End If
d) The label1 is a form label added to the HTML document for example
<tr class="Row">
<td> {Label1} {Variance} </td>
</tr>
You should set the label content in the label properties to HTML.
There are other things you can do here as well, using style sheets, a class, or just straight HTML code as shown in this message.
Quote TBMH:
Soooo.......I'm guessing this either isn't possible, or isn't easy.
Is this correct?
_________________
Greg Martin
gmartin@microresource.co.uk |
 |
 |
|