English 中文(简体)
如何给电网第一栏提供颜色?
原标题:how to give the color to first column of the grid?
  • 时间:2012-01-12 10:00:02
  •  标签:
  • asp.net

i 想给第一个同电网头盔一样的表象。

this is the image of original grid which i want. this is the image of original grid which i want..

这就是我现在所展示的我的形象。

这就是我现在所展示的我的形象。..

and this grid is created dynamically and all data are filld from server. so i want is to give color to only first coloumn ( not all coloumn , as shown in image)of grid at runtime

最佳回答

You could do this using simple CSS

table tr td:first-child
{
    background-color: #FACF7B;
}

www.un.org/Depts/DGACM/index_spanish.htm 但这一规则将适用于所有表格。 您可以将其改为仅适用于某些表格,例如:

.myTable tr td:first-child /* all tables with class="myTable" */
{
    background-color: #FACF7B;
}

#myTable tr td:first-child /* tables with id="myTable" */
{
    background-color: #FACF7B;
}
问题回答

在你的第一个模板领域添加项目

<HeaderStyle BackColor="#FEFF01" HorizontalAlign="Center"  />
 <ItemStyle BackColor="#FEFF01" Font-Bold="True" HorizontalAlign="Center" />

EDIT:

我的网格看法就在这里。

<asp:GridView ID="GridViewOrganizationShareFee" runat="server" 
                        AutoGenerateColumns="False" BackColor="White">
                         <HeaderStyle BackColor="#FFC000" Font-Bold="True" ForeColor="Black" Height="45px" HorizontalAlign="Center"  />
                         <RowStyle ForeColor="Black" BackColor="#FFFDFF" Font-Bold="true" />                      
                    <Columns>                  
                     <asp:TemplateField HeaderText="Organization">
                            <ItemTemplate>
                                <asp:Label ID="LabelOrganizationName" runat="server" Text= <%#Eval("OrganizationID").ToString()=="0"?"n/a":Eval("Name") %> ></asp:Label>
                            </ItemTemplate>                           
                            <HeaderStyle BackColor="#FEFF01" HorizontalAlign="Center"  />
                            <ItemStyle BackColor="#FEFF01" Font-Bold="True" HorizontalAlign="Center" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="Fee Type">
                             <ItemTemplate>
                               <asp:Image ID="ImageDollor" runat="server" ImageUrl="~/Images/Icons/dollor.png" Visible= <%#Eval("DojoEventPaymentType").ToString().ToLower()=="a"?true:false %>  />
                                 <asp:Image ID="ImagePercent" runat="server" ImageUrl="~/Images/Icons/percent.png" Visible= <%#Eval("DojoEventPaymentType").ToString().ToLower()=="p"?true:false %>  />            </ItemTemplate><ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>

                    </Columns>
                    </asp:GridView>    

Try this:

GridView1.Columns[0].ItemStyle.BackColor = System.Drawing.Color.Orange;
GridView1.Columns[0].ItemStyle.BackColor = System.Drawing.Color.Red;

在你对电网数据进行约束之后,担任这一职务。 之后

GridView1.DataBind();




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签