gradient for selected row in asp.net gridview
Can a gradient color be assigned to the select开发者_如何转开发ed row? I tried but it is being assigned at the cell level so in each n every cell i have the start color and the end color.
I'm not sure if you could do a gradient color per se, but there are ways to assign a color to a given row in a table.
If you are using the ASP.NET GridView and just wish to have a way of distinguishing between rows you can use the AlternatingRowStyle property to alternate the colors which makes it easier to distinguish between the fields.
Another option is to just return a fairly generic table and then use jQuery to manipulate it on the client side. If you go this route, then there are techniques describe that allow you to set a row color on click, as described in this tutorial.
You could apply a css class to the selected row and use a gradient image as the background-image in the css properties.
Using this you can achieve your goal
<AlternatingRowStyle CssClass="highlight" BackColor="Silver"/>
<EditRowStyle CssClass="bluishBack"/>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle CssClass="style" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle CssClass="highlight" BackColor="Silver"/>
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
精彩评论