当前位置:编程学习 > C#/ASP.NET >>

请问在Repeater中有一个Table,如何给这个table动态添加标题列及动态绑定的数据列

<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
                <HeaderTemplate>
                    <table id="tbMain" runat="server" width="1600px" border="0" align="center" cellpadding="0"
                        cellspacing="0" class="UrgerTable">
                        <tr>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                客户名称</td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                销售人员</td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                项目类型</td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                <asp:Label ID="lblPlanSignDate" runat="server" Text="">计划签约年月</asp:Label></td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                <asp:Label ID="lblPlanCarryOutDate" runat="server" Text="">计划实施年月</asp:Label></td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                产品名称</td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                数量</td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap;">
                                <asp:Label ID="lblPrice" runat="server" Text="">报(单)价</asp:Label></td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap; width: auto;">
                                <asp:Label ID="lblExpectedIncome" runat="server" Text="">预计收入</asp:Label></td>
                            <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px; background-color: #e3efff;
                                white-space: nowrap; width: auto;">
                                <asp:Label ID="lblCurrentIncomeExpected" runat="server" Text="">当前收入预估</asp:Label></td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%# Eval("CustomerName")%>
                            <asp:HiddenField ID="hfProjectID" runat="server" Value='<%# Eval("ProjectID") %>' />
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%#GetUserNameByUserLoginID(Convert.ToString(Eval("CreatUserName"))) %>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%# Eval("ProjectTypeName")%>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("ProjectID") %>' />
                             <asp:Label ID="lblSignDate" runat="server" Text='<%#  Eval("PlanSignDate", "{0:yyyy-MM}")%>'></asp:Label>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <asp:Label ID="lblCarryOutDate" runat="server" Text='<%# Eval("PlanCarryOutDate", "{0:yyyy-MM}")%>'></asp:Label>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%# Eval("ProductName")%>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%# Eval("ProductNumber")%>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%# Eval("Price", "¥{0:N0}")%>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%# Eval("ExpectedIncome", "¥{0:N0}")%>
                        </td>
                        <td style="border: 1px solid #a7c5e2; border-width: 0 1 1 0; height: 25px;">
                             <%# Eval("CurrentIncomeExpected", "¥{0:N0}")%>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>

以上是页面上的代码,需要在项目类型列和计划签约时间之间添加一些数据绑定列。请问如何动态添加!谢谢各位高手了! --------------------编程问答-------------------- 建议自己写table的innerHTML Repeater 里也可以实现 就是有点绑手绑脚 --------------------编程问答-------------------- 我也有这个问题!
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,