如何在Gridview中为控件添加颜色

如何在Gridview中为控件添加颜色

本文介绍了如何在Gridview中为控件添加颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网格视图中返回备用行的颜色。有用。同时如何使用相同颜色对备用行的控件进行着色。对于boundfield,它可以,但对于像Textbox这样的其他控件,如何制作它。其他控件的背面颜色为白色,看起来不太好。



I want to back color alternate rows in a gridview. It works. At the same time how to color back of controls of alternate rows with the same color. For boundfield it is OK but for other controls like Textbox , how to make it. The back color of other control is white and does not look nice.

<asp:GridView ID="grvcart" runat="server"   style=" margin-top:447px; margin-left:450px ; "   BorderStyle="Groove" BorderWidth="1" BorderColor="White"

                ShowFooter="True" AutoGenerateColumns="False" GridLines="None"  Width="787" HeaderStyle-Font-Size="Small" HeaderStyle-ForeColor="White"

                CellPadding="4" ForeColor="#999999"  OnRowDeleting="grvcart_RowDeleting" HeaderStyle-BackColor="#666666"  RowStyle-BackColor="White" AlternatingRowStyle-BackColor="#cccccc" >
    <Columns>
        <asp:BoundField DataField="RowNumber" HeaderText="SNo"  />

        <asp:TemplateField HeaderText="Product Id" >
        <ItemTemplate>
        <asp:TextBox ID="TBProductId" Width="44"     runat="server" ReadOnly="true" ForeColor="Black"  BorderStyle="None" Style=" text-align:center"

        Text=''></asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>

推荐答案


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript">



这篇关于如何在Gridview中为控件添加颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 21:56