[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

08/27/2008 at 12:48AM PDT, ID: 23681166
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Gridview background image label not centered

Asked by iepaul in Programming for ASP.NET

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="SqlDataSource1"
        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="fldWebLink"
                DataNavigateUrlFormatString="/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:url('<%# Eval ( "fldStatusMonth", "/ews/images/{0}.gif" ) %>');background-repeat:no-repeat;background-position:center;height:50px;vertical-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_ContentPlaceHolder1_GridView1" style="color:#333333;border-collapse:collapse;">
            <tr style="color:White;background-color:#507CD1;font-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.aspx">Health and Safety</a></td><td>
                    <span id="ctl00_ContentPlaceHolder1_GridView1_ctl02_Label2">31/07/2008</span>
                </td><td>
                    <div style="background-image:url('/ews/images/3.gif');background-repeat:no-repeat;background-position:center;height:50px;vertical-align:middle;">
                        <span id="ctl00_ContentPlaceHolder1_GridView1_ctl02_Label1">3</span>
                    </div>
                </td><td>
                    <img src='images/4.gif'>
                </td><td>                    </td>
            </tr>
      </table>
 
Keywords: Gridview background image label not c…
 
Loading Advertisement...
 
[+][-]08/28/08 04:29 PM, ID: 22340913

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Programming for ASP.NET
Sign Up Now!
Solution Provided By: lijunguo
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20090824-EE-VQP-74 / EE_QW_2_20070628