0

次のように、ListView コントロールを使用して、データベースからのデータのリストを表示しようとしています。

従業員名: xxxxxxxxx ID: 111111 役職: yyyyyxxxx 組織: uuuuuu

つまり、次のように並べ替えられた 4 列のテーブルにデータを一覧表示する必要があります。 プロパティ プロパティ

このスタイルになるように を変更したところ、成功しました。私の問題は、両方の値の列でデータベースからデータを取得することです。私はそれを行う方法がわかりません。

私のコードの一部:

<LayoutTemplate>
    <table border="0" cellpadding="1">
        <tr style="background-color:#003366; color:white">
            <th align="left"> Employee Name </th>
            <td>
            </td>

            <th align="left">ID</th>
            <td></td>
        </tr>

        <tr style="background-color:#003366; color:white"> 
            <th align="left">Job Title.</th>
            <td></td>

            <th align="left">Organization</th>
            <td></td>
        </tr>


        <tr id="itemPlaceholder" runat="server">
        </tr>

    </table>
</LayoutTemplate>
4

1 に答える 1

1
    <LayoutTemplate>
        <table border="0" cellpadding="1">
            <tr style="background-color:#003366; color:white">
                <th align="left"> Employee Name </th>
                <td>
                </td>

                <th align="left">ID</th>
                <td></td>
            </tr>

            <tr style="background-color:#003366; color:white"> 
                <th align="left">Job Title.</th>
                <td></td>

                <th align="left">Organization</th>
                <td></td>
            </tr>
            <asp:PlaceHolder id="itemPlaceholder" runat="server" />

        </table>
    </LayoutTemplate>
    <ItemTemplate>
            <tr style="background-color:#003366; color:white">
                    <td align="left"></td>    
                    <td><%# Eval("EmployeeName")%></td>

                    <td align="left"></td>
                    <td><%# Eval("ID")%></td>
                </tr>

                <tr style="background-color:#003366; color:white"> 
                    <td align="left"></td>
                    <td><%# Eval("JobTitle")</td>

                    <td align="left"></td>
                    <td><%# Eval("Organization")</td>
                </tr>
    </ItemTemplate>

Eval ステートメントはデータソースによって異なります

于 2011-10-16T08:37:57.050 に答える