G
Guest
I've searched, reviewed, and attempted dozens of code ideas on the subject. I
can't seem to get something that seems so simple to work. To highlight a row
in a datagrid based on another value in that row.
I have a datagrid using Template and Item Columns, i.e.:
<asp:TemplateColumn HeaderText="CA Date Req"
HeaderStyle-CssClass="gridqtext" ItemStyle-CssClass="gridtext">
<ItemTemplate>
<asp:Label ID="lblcadatereq" CssClass="gridtext" width="75" Runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Concern_DCADate", "{0:d}") %>'
Visible="True">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
I've tried both Oncreate and OnDataBound, no luck. I have several columns,
but I need values from checkbox (#3) and Label (#4). I've tried, etc.:
CType(E.Item.FindControl("lblcadatereq"), Label).Text
What is strange is that when I run (Onitemcreated):
Response.Write("value = " & e.Item.Cells(4).Text & "<br>")
I get, there are four rows in my grid (header, two data, a blank bottom
row). I get:
#1 value = "Title of Header"
#2 - 4 value = (is blank). The grid shows data in #2 and #3???
I have also ran a routine to remove the first and last rows using:
e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem
but still no values from grid for rows 2 and 3????
can't seem to get something that seems so simple to work. To highlight a row
in a datagrid based on another value in that row.
I have a datagrid using Template and Item Columns, i.e.:
<asp:TemplateColumn HeaderText="CA Date Req"
HeaderStyle-CssClass="gridqtext" ItemStyle-CssClass="gridtext">
<ItemTemplate>
<asp:Label ID="lblcadatereq" CssClass="gridtext" width="75" Runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Concern_DCADate", "{0:d}") %>'
Visible="True">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
I've tried both Oncreate and OnDataBound, no luck. I have several columns,
but I need values from checkbox (#3) and Label (#4). I've tried, etc.:
CType(E.Item.FindControl("lblcadatereq"), Label).Text
What is strange is that when I run (Onitemcreated):
Response.Write("value = " & e.Item.Cells(4).Text & "<br>")
I get, there are four rows in my grid (header, two data, a blank bottom
row). I get:
#1 value = "Title of Header"
#2 - 4 value = (is blank). The grid shows data in #2 and #3???
I have also ran a routine to remove the first and last rows using:
e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem
but still no values from grid for rows 2 and 3????