数据绑定使用#eval从一个数据集多个表以中继器() [英] bind data to repeater from multiple tables from a single dataset using #eval()

查看:157
本文介绍了数据绑定使用#eval从一个数据集多个表以中继器()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储过程返回多个选择。这个过程的结果存储在一个数据集。因此,该数据集包含2个表,表1和放大器;表2。
结果的表1
查看表1结构

i have a stored procedure returning multiple select. the result from this procedure is stored in a dataset. So the dataset contain 2 table, table1 & table2.
table1 View Table1 Structure

结果表2 查看表2结构

我有一个Repeater控件像这样

i have a repeater control like this

<asp:Repeater ID="rptrDetails" runat="server">
        <HeaderTemplate>
            <table style="width: 100%" class="table-popup" border="1">
                <tr>
                    <th>
                        Payment Date
                    </th>
                    <th>
                        Payer Type
                    </th>
                    <th>
                        Payer Description
                    </th>
                    <th>
                        Payment Method
                    </th>
                    <th>
                        Check No
                    </th>
                    <th>
                        Amount
                    </th>
                    <th>
                        &nbsp;
                    </th>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <%# Eval("PaymentDate")%>  //from table1
                </td>
                <td>
                    <%# Eval("PayerType")%>  //from table1
                </td>
                <td>
                    <%# Eval("PayerDescription")%> //from table1
                </td>
                <td>
                    <%# Eval("PaymentMethod")%> //from table1
                </td>
                <td>
                    <%# Eval("CheckNo")%> //from table1
                </td>
                <td>
                    <%# Eval("Amount")%> //from table1
                </td>
                <td>
                    <img src="Images/expand.png" alt="click here to see details" onclick='ToggleDisplay(<%#Container.ItemIndex %>);'
                        style="cursor: pointer; height: 15px; width: 15px" />
                </td>
            </tr>
            <tr id='coldiv<%#Container.ItemIndex %>' style="display: none;">
                <td colspan="7">
                    <div>
                        <table style="width: 100%">
                            <tr>
                                <td>
                                    s
                                </td>
                                <td>
                                    <%# Eval("lName") %> //from table2
                                </td>
                                <td>
                                    s
                                </td>
                                <td>
                                    <%# Eval("fName") %> //from table2
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    s
                                </td>
                                <td>
                                    <%# Eval("mName") %> //from table2
                                </td>
                                <td>
                                    sd
                                </td>
                                <td>
                                    <%# Eval("city") %> //from table2
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>

如何将数据从表2到这个中继器绑定。我收到提示说,从表2中的字段名没有找到。请帮助。

how to bind the data from table2 to this repeater. i'm getting error says the field names from table2 not found. please help.

有没有喜欢的eval(表[0] .PaymentDate)或评估和演示任何方式(表[0]。城市)

is there any way like Eval("Table[0].PaymentDate") or Eval("Table[0].city")

推荐答案

请一个新的临时数据表,把你需要的列从数据集到临时数据表,并在简单的方式绑定像你正在做的。

Make a new temporary DataTable and put your required columns from your Dataset into the temporary DataTable and bind it in the simple way like you are doing.

这篇关于数据绑定使用#eval从一个数据集多个表以中继器()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆