locked
GridView Selected Row RRS feed

  • Question

  • User-154964619 posted

    Hi,

     I am using css-friendly control adapters and have a gridview where I would like to style the

    selected rows using css.

    I tried

    .AspNet-GridView .GridView .AspNet-GridView-Selected SelectedRow .td(and without td)

    {

    color:Green;background:Yellow;

    }

     

    Where, in the Gridview, the CssClasses are set as

    SelectedRowStyle-CssClass="SelectedRow" CssClass="GridView"

    --------------

     I would be glad if someone could help me in styling selected rows.

    Thanks.

     

    Sunday, August 10, 2008 4:38 PM

Answers

  • User-154964619 posted
    .AspNet-GridView .GridView .AspNet-GridView-Selected

    {

    background:Yellow;

    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 12, 2008 2:57 PM

All replies

  • User-748361252 posted

    Hi,

    Use the following in the girdview markup to set the selected row style.

    <SelectedRowStyle BackColor="Red" />

    For example;

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="testid">
    <Columns>
    <asp:BoundField DataField="testid" HeaderText="testid" InsertVisible="False" ReadOnly="True" SortExpression="testid" />
    </Columns> 
     <SelectedRowStyle BackColor="Red" />
    </asp:GridView>

    Hope, it will help.

    Regards,

    Danish

    Sunday, August 10, 2008 5:23 PM
  • User-748361252 posted

    hi,

     you can also use it as follows.

    <SelectedRowStyle cssClass="test" />

    Regards,

    Danish

    Sunday, August 10, 2008 5:25 PM
  • User-154964619 posted

    Hi Danish,

    Thanks for the reply. Setting the style at the markup of gridview doesnt work because I am using css friendly control adapters I think.

    As for the class, I have already put a class name for the SelectedRowStyle but could not manage to make that work.

    SelectedRowStyle-CssClass="SelectedRow" CssClass="GridView"

    .AspNet-GridView .GridView .AspNet-GridView-Selected SelectedRow .td(and without td)

    {

    color:Green;background:Yellow;

    }

    Monday, August 11, 2008 4:29 AM
  • User-154964619 posted
    .AspNet-GridView .GridView .AspNet-GridView-Selected

    {

    background:Yellow;

    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 12, 2008 2:57 PM