💼 정보 ver1.0

Panel을 이용한 막대그래도 표현하기

James Wetzel 2010. 8. 2. 20:17
728x90
반응형
.aspx
------------------------------------------------------
<style type="text/css">
.graph
        {
         position:static;
         border:1px solid gray;          
        }
        .graph .bar
        {
            display:block;
            position:relative;
            background:#ABE00C;
            height:1em;
            line-height:1em;
        }
</style>
 <ItemTemplate>
                <table border="0" style="background-color:White;">
                 <tr style="height:20px;">
                     <td style="width:40px;" align="center">
                         <asp:Label ID="NoLabel" runat="server" Text='<%# Eval("No") %>' />
                     </td>
                     <td style="width:110px;">
                         <asp:Label ID="jobNameLabel" runat="server" Text='<%# Eval("jobName") %>' />
                     </td>
                     <td style="width:115px;">
                         <asp:Label ID="companyNameLabel" runat="server"
                             Text='<%# Eval("companyName") %>' />
                     </td>
                     <td style="width:335px;">
                         <asp:Panel ID="graphLayOut" CssClass="graph" runat="server">
                             <asp:Panel ID="statebar" CssClass="bar" runat="server" Width='<%# getWidth(""+Eval("completionPercent")+"") %>' HorizontalAlign="Right"><%# Eval("completionPercent") %>%</asp:Panel>
                         </asp:Panel>
                     </td>
                 </tr>
                 </table>
                 <table style="width:100%;">
                    <tr style="height:1px;">
                        <td style="background-color:#A0A0A0;"></td>
                    </tr>
                 </table>
             </ItemTemplate>       
.cs
--------------------------------------------------------
protected Unit getWidth(string width)
        {
            return Unit.Parse(width+"%");           
        }
728x90
반응형