2011-06-10 94 views
4
<asp:GridView ID="grdUploadedFiles" runat="server" AutoGenerateColumns="False" AllowPaging="True" 
        PageSize="7" DataKeyNames="ID" OnRowEditing="grdUploadedFiles_RowEditing" OnRowUpdating="grdUploadedFiles_RowUpdating" 
        OnRowCancelingEdit="grdUploadedFiles_RowCancelingEdit" OnRowDeleting="grdUploadedFiles_RowDeleting" 
        ShowFooter="True" ForeColor="Black" GridLines="Vertical" 
        Width="439px" BackColor="White" BorderColor="#999999" BorderStyle="Solid" 
        Font-Size="Small" Font-Names="Arial" CellPadding="3" BorderWidth="1px"> 
        <Columns> 

         <asp:TemplateField HeaderText="Type" HeaderStyle-HorizontalAlign="Center" > 
          <ItemTemplate> 
           <asp:Label ID="lblType" runat="server" Text='<%# Bind("FileType") %>'></asp:Label> 
          </ItemTemplate> 
          <asp:CommandField ShowEditButton="True"> 
          <ItemStyle/> 
         </asp:CommandField></column></gridview> 

我使用上面的代碼爲我的gridview.and我想填充到我的第1列。並且我想給我的下劃線我的編輯和刪除鏈接在我的gridview.For如果我給textuderline ='真正的「在編輯它顯示更新刪除這兩個看起來醜陋的單個下劃線 是否有任何其他方式?如何從gridview給gridview第一列左邊距?

回答

2

我會建議使用CSS選擇器的樣式,而不是使用控制屬性(生成難以維護的內聯樣式/更改) - 假設您已將css類「myGridView」應用於您的網格視圖,請使用CSS,例如

table.myGridView 
{ 
    color: black; 
    border: solid 1px #999999; 
    background-color: white; 
    width: 439px; 
    font-family: arial; 
} 

table.myGridView th 
{ 
    // style your column headings 
} 

table.myGridView td 
{ 
    // style your cells 
    padding: 3px; 
} 

table.myGridView tr td:first-child 
{ 
    // style the first cell in each row 
    padding-left: 10px; 
}