首页 新闻 会员 周边 捐助

Repeater 控件绑定数据,

0
[已解决问题] 解决于 2014-09-29 16:08

table中Repeater绑定数据。如何使其数据居中呢。还有突出部分。请问怎么解决呢

小二炒豆芽菜的主页 小二炒豆芽菜 | 菜鸟二级 | 园豆:418
提问于:2014-09-29 11:35
< >
分享
最佳答案
0

贴一下你绑定的源码。这样别人可以更准确的绑定你呢。style="border: 1px solid #cccccc; text-align: center

这一段样式你是给的行呢?还是列呢。不知道你外面的容器是啥。是不是table外还有容器,2个的宽度不一致,可以给table宽度100%,然后给<td>宽度 几%。如过时5列,就每列20%。

奖励园豆:5
大楚打码人 | 老鸟四级 |园豆:4313 | 2014-09-29 11:59

<asp:Content ID="Content3" ContentPlaceHolderID="Body" runat="server">
    <table class="fixtable" style="border: 1px solid #cccccc; text-align: center" ><%--style="border: 1px solid #cccccc; text-align: center"--%>
        <tr>
            <th>编号</th>
            <th>本月工作</th>
            <th>年假</th>
            <th>事假</th>
            <th>病假</th>
            <th>调休</th>
            <th>产假</th>
            <th>其他</th>
            <th>旷工(天)</th>
            <th>加班(小时)</th>
            <th>迟到/早退(次)</th>
            <th>扣款(天)</th>
        </tr>

        <asp:Repeater ID="RP_Relation" runat="server">
            <ItemTemplate>
                <tr>
                    <td>
                        <asp:TextBox ID="txtEmpName" Text='<%# Eval("EMPID") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtMonths" Text='<%# Eval("MONTHWORKDAYS") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtYearDays" Text='<%# Eval("ANNUALLEAVE") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtComEave" Text='<%# Eval("COMPASSIONATELEAVE") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtSick" Text='<%# Eval("SICKLEAVE") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtSoff" Text='<%# Eval("DAYSOFF") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtMate" Text='<%# Eval("MATERNITYLEAVE") %>' runat="server"></asp:TextBox>
                    </td>

                    <td>
                        <asp:TextBox ID="txtOther" Text='<%# Eval("OTHERLEAVE") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtSkip" Text='<%# Eval("SKIPWORKDAYS") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtExt" Text='<%# Eval("EXTRAWORKHOURS") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtLate" Text='<%# Eval("LATECOUNT") %>' runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:TextBox ID="txtDeduct" Text='<%# Eval("DEDUCTDAYS") %>' runat="server"></asp:TextBox>
                    </td>
                </tr>
            </ItemTemplate>
        </asp:Repeater>

        <tr>
            <td style="float: right; padding-right: 20px">
                <dx:ASPxButton ID="btnSave" runat="server" Text="保&nbsp;存" OnClick="btnSave_Click" Theme="SoftOrange" Width="100px" Style="float: right; margin-right: 20px">
                </dx:ASPxButton>

            </td>
            <td>
                <dx:ASPxButton ID="btnClose" runat="server" Text="取&nbsp;消" Theme="SoftOrange" Width="100px" AutoPostBack="false">
                      <ClientSideEvents Click="function(s,e){window.location='Company.aspx'}"/>
                </dx:ASPxButton>

            </td>

        </tr>
    </table>

</asp:Content>

小二炒豆芽菜 | 园豆:418 (菜鸟二级) | 2014-09-29 12:03

@我二我快乐: <style type="text/css">
table.tables(这里的tables是table用的样式名){
 width:100%;
}
table.tables th {
 width: 8%;
}
table.tables td {
 text-algin:center;

 width: 8%;
}
</style>

这段样式比较粗略,不过大楷就这意思。写下样式控制下th.td的宽度。然后文字居中即可。

大楚打码人 | 园豆:4313 (老鸟四级) | 2014-09-29 12:11
其他回答(2)
0

这些是CSS的事。

爱编程的大叔 | 园豆:30844 (高人七级) | 2014-09-29 11:42

style="border: 1px solid #cccccc; text-align: center" 请问怎么设置呢

支持(0) 反对(0) 小二炒豆芽菜 | 园豆:418 (菜鸟二级) | 2014-09-29 11:51
0

<td align="center">
内容....
</td>

柠檬果子 | 园豆:233 (菜鸟二级) | 2014-09-29 11:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册