troubleshooting Question

SelectedRowStyle not working on GridView control - I simply want to highlight the selected row, but its not working!

Avatar of jazz__man
jazz__man asked on
.NET ProgrammingASP.NETVisual Basic.NET
6 Comments2 Solutions4741 ViewsLast Modified:
Hi,

Could someone please advise me on the selction of a row on the following gridview control.
When I select a row on the grid I want the row colour to change, I have done this before and it is my understanding that this sort of thing is usually very easy on a grid view control, however it is proving to be a bit of a nuisance.
I have tried setting the background colour of the SelectedRowStyle of the grid and also tried applying the colour using CSS, but nothing seems to be working. Is there something obvious I am doing wrong?

Thanks in advance.
<asp:GridView ID="gvTest"  runat="server" CssClass="GridFormat" AutoGenerateColumns="False" GridLines="None" DataKeyNames="MyID" >
                        <HeaderStyle CssClass="GridHeader"/>
                        <Columns>
                        <asp:BoundField DataField="MyID" Visible="False" HeaderText="MyID" />
                            <asp:BoundField DataField="Head1" HeaderText="Head1" />
                            <asp:BoundField DataField="Head2" HeaderText="Head2" />
                            <asp:BoundField DataField="Head3" HeaderText="Head3" />
                            <asp:BoundField DataField="Head4" HeaderText="Head4" />
                            <asp:TemplateField ShowHeader="False">
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnMyImageButton" runat="server"                               ImageUrl="../Images/ButtonImage.gif" CausesValidation="False"                               CommandName="Select" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" />
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros