I have got some help with placing a background image on a gridview cell which works but now when I put text in the cell it is aligned to the top of the cell and not the middle. All other cells are aligned to the middle. The gif file is a green circle and I want the value to appear over it.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False
" DataSourceID="SqlDataSourc
e1"
CellPadding="4" ForeColor="#333333" GridLines="None" CssClass="gridviewStyle">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="fld
WebLink"
DataNavigateUrlFormatStrin
g="/ews/{0
}" DataTextField="fldKRIName"
HeaderText="KRI" />
<asp:TemplateField HeaderText="Date" SortExpression="fldDate">
<ItemTemplate>
<asp:Label ID="Label2" runat="server"
Text='<%# Bind("fldDate", "{0:dd/MM/yyyy}") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("fldDate") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Month">
<ItemTemplate>
<div style="background-image:ur
l('<%# Eval ( "fldStatusMonth", "/ews/images/{0}.gif" ) %>');background-repeat:no-
repeat;bac
kground-po
sition:cen
ter;height
:50px;vert
ical-align
:middle;">
<asp:Label ID="Label1" runat="server"
Text='<%# bind("fldstatusmonth") %>'></asp:Label>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="YTD">
<ItemTemplate>
<img src='<%# Eval ( "fldStatusYTD", "images/{0}.gif" ) %>'>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="fldComment"
HeaderText="Comment" SortExpression="fldComment
" />
</Columns>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
here is the resulting html code -
<table class="gridviewStyle" cellspacing="0" cellpadding="4" border="0" id="ctl00_ContentPlaceHold
er1_GridVi
ew1" style="color:#333333;borde
r-collapse
:collapse;
">
<tr style="color:White;backgro
und-color:
#507CD1;fo
nt-weight:
bold;">
<th scope="col">KRI</th><th scope="col">Date</th><th scope="col">Month</th><th scope="col">YTD</th><th scope="col">Comment</th>
</tr><tr align="center" valign="middle">
<td><a href="/ews/hs/hsdisplay.as
px">Health
and Safety</a></td><td>
<span id="ctl00_ContentPlaceHold
er1_GridVi
ew1_ctl02_
Label2">31
/07/2008</
span>
</td><td>
<div style="background-image:ur
l('/ews/im
ages/3.gif
');backgro
und-repeat
:no-repeat
;backgroun
d-position
:center;he
ight:50px;
vertical-a
lign:middl
e;">
<span id="ctl00_ContentPlaceHold
er1_GridVi
ew1_ctl02_
Label1">3<
/span>
</div>
</td><td>
<img src='images/4.gif'>
</td><td> </td>
</tr>
</table>