klipkop
Posts: 16
|
Posted: 11/18/2008, 2:18 AM |
|
There is a lot of examples on how to highlight the selected row in a grid, but they are all in PHP. Can someone please explain it for ASP.NET. The best entry describing it is:
http://forums.yessoftware.com/posts.php?post_id=90764
______________________________________________________________________
Okay, if you're familiar with setting template variables, set one for
the row style. In your HTML:
<tr style="{rowStyle}">
In your BeforeShowRow event:
global $Tpl;
if ($Container->ds->f("id") == CCGetParam("id", "")) {
I dont''understand this $container and the .NET (VB) equivalent
$Tpl->SetVar("rowStyle", "bgcolor='RED'");
}
else {
$Tpl->SetVar("rowStyle", "bgcolor='WHITE'");
}
Where "id" is your link parameter to show the record detail. Note that
if you have any other inline styles in your <TD>'s, those will override
what's in your <TR>. You could just set your <TD> style also as such:
<td style="{dataStyle}">
-------------------------------------------------------------------------------------------------------------
I can't get it to work in .NET. The sample in CCS4 only describe changing celcolour for alternative rows. My partially completed code is as follows:
HTML:
<tr id="task_row" runat="server">
BEFORE SHOW ROW event
Dim ID As Integer ' The ID of the selected row
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim task_row As System.Web.UI.HtmlControls.HtmlTableCell = DirectCast(e.Item.FindControl("task_row"),System.Web.UI.HtmlControls.HtmlTableCell)
If CONTAINER = ID Then ' Need the pointer to the selected row
task_row.Attributes("bgcolor") = "RED" ' will bgcolour work here?
task_row.Attributes
Else
task_row.Attributes("Class") = "AltRow"
Counter = 0
End IF
End If
|