Hi all,
I am trying to get a row to highlight when selected via a linkbutton in a templatefield in a gridview. I've tried lots of different things to make the row highlight, but to no avail. Because I am calling a CommandName which is different to 'Select' (the CommandName I am calling is 'SelectThisRow'; it performs actions on other pieces of code) obviously this won't call the standard, built-in Selected Row functions. Can someone review the following code and just tell me what piece of code I need to make the row highlight?
Thanks,
GC
<script language="
VB" runat="server">
Sub UpdateDetails(ByVal sender As Object, ByVal Args As CommandEventArgs)
If Args.CommandName = "SelectThisRow" Then
'This following line kicks off a process in a user control
TestRecord.BindGrid(Args.CommandArgument)
End If
End Sub
</script>
<asp:AccessDataSource id="BookSource" Runat="Server"
DataFile="../Databases/BooksDB.mdb"
SelectCommand="SELECT * FROM Books WHERE BookType='Graphics'
ORDER BY BookID"/>
<asp:GridView id="BookGrid" DataSourceID="BookSource" Runat="Server"
AutoGenerateColumns="False"
ShowFooter="True"
Caption="<b>Graphics Books</b>"
CellPadding="3"
BorderStyle="Ridge"
BorderWidth="5"
BackColor="#F0F0F0"
ForeColor="#000000"
Font-Size="10pt"
>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="BtnSelectValue" runat="server" OnCommand="UpdateDetails" CommandName="SelectThisRow" CommandArgument='<%# Eval("BookID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField
DataField="BookID"
HeaderText="ID"
FooterStyle-BorderWidth="0"/>
<asp:BoundField
DataField="BookTitle"
HeaderText="Title"
FooterStyle-BorderWidth="0"/>
</Columns>
</asp:GridView>
<gc:UserControl ID="TestRecord" runat="server" />