Reputation: 321
<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>
I am using above code for my gridview.and i want to give padding to my 1st column.and also i want to give underline to my edit and delete link in my gridview.For that if i give textuderline='true" on editing it shows Update Delete both a single underline which looks ugly. Is there any other way?
Upvotes: 4
Views: 7729
Reputation: 49185
I will suggest using CSS selectors for styling instead of using control properties (that generates inline styling that are difficult to maintain/change) - assuming you have applied css class "myGridView" to your grid view then use CSS such as
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;
}
Upvotes: 2