kriska
Posts: 18
|
| Posted: 12/17/2009, 11:56 PM |
|
dear all,
i have created a messaging system. there is a view link of each message in order to view each message. when a user click the view link then its update the status data column in to one in the message database table and i viewed how many unread messages in the message box to the user.
but when we go to the message box it is difficult to recognize the unread messages from the read messages. so i want to change the font color of the read messages in order to recognize them. but i dont know how to do it. can any one help me on this matter.
thank you,
regards
kriska
|
 |
 |
Aleister
Posts: 73
|
| Posted: 12/18/2009, 11:37 PM |
|
You can use a label control to change the style class. For example, if you have:
<a href="readmessage.php?something=1">Read message</a>
Change it like this:
<div class="[Label]"><a href="readmessage.php?something=1">Read message</a></div>
In before show event of [Label] you can set the corresponding class like this:
if (YOUR_CHECK_IF_MESSAGE_HAS_BEEN_READED)
{
$Component->SetValue("HasBeenReaded") ;
}
else
{
$Component->SetValue("HasNotBeenReaded") ;
}
There is even a simpler way by naming your css classes .something1 and .something0 and use label without events like this:
<div class="something[Label]">
<a href="readmessage.php?something=1">Read message</a>
</div>
where label will get control source from the field you keep the state of the record (read/unread)
Of course you need to define the classes you are going to use, preferably to a Stylesheet which you will include in every page, e.g. Styles/{CCS_Style}/Style2.css
I hope I didn't confuse you.
|
 |
 |
kriska
Posts: 18
|
| Posted: 12/23/2009, 12:56 AM |
|
hi
i tried what you asked me to do but i was failed. actually i just want to change the row color when the message is red. could you please explain me how to do it.
thank you.
|
 |
 |
Aleister
Posts: 73
|
| Posted: 12/23/2009, 7:28 AM |
|
If you want to change the background color of the row you can try this:
In HTML view, for every row on your grid you have:
<tr class="Row">
...
...
</tr>
In HTML view, add a label just before Row:
<tr class="{Label1}Row">
...
...
</tr>
In the before show event of the label set the value of label like this:
// Label1 Before show
if (YOUR_CHECK_IF_HAS_BEEN_READED_HERE)
{
$Component->SetValue("Alt");
}
// End of before show
By doing that, every time that a message has been readed the row will get the color of AltRow from the style you use.
If you already use alternate rows, you can define a new class of your own and change the above like this:
In HTML:
<tr class="{Label1}">
...
...
</tr>
And in label before show like this:
// Label1 Before show
if (PLACE_HERE_YOUR_CHECK_IF_HAS_BEEN_READED)
{
$Component->SetValue("YourClassForHasBeenReaded");
}
else
{
$Component->SetValue("Row");
}
// End of before show
I am guessing that you know how to get in your custom code the value of $IsReaded for current row. If not, I can give you further instructions.
|
 |
 |
kriska
Posts: 18
|
| Posted: 12/24/2009, 12:19 AM |
|
thank you for replying me.
i use another way to do that and it works fine.
i use the sql codes change that without using berore show event. there in the grid i have select the data sourse and there i have click the ... button and write the code there
SELECT if(isSender_viewed,'Row1','Row') AS RowStyle, msg_to_id, msg_title, posted_date
FROM (data source table)
WHERE (write the code what you want)
it works really nice. thank you
|
 |
 |
|