本文介绍了如何在Repeater控件的一行中显示不同的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个中继器控件.其中有一个图像按钮,用于显示与电影"表的每一行相对应的图像.

现在我想在单击特定图像后,在页面的文本框中显示其他字段(例如电影名称,星空等).与电影图像对应的字段.

怎么做?请帮忙.
检查下面的代码:

I have a repeater control. In it, I have an image button which shows the images corresponding to each row of my Movie table.

Now I want to display some other fields(like moviename,starcast etc.) in the text boxes in the page,after clicking a particular image,i.e. fields corresponding to the movie image clicked.

How to do that? Please help.
Check my code below:

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"

            >
        <ItemTemplate>
            <table id="Table1" cellpadding="1" cellspacing="1" visible ="true">
            <tr>
                <td width="50px">
                <td width="20px">
                    <p align="left">
                    <%--<asp:Label ID="MovieID" runat = "server" Text='<%# DataBinder.Eval(Container.DataItem,"Mov_ID")%>' >
                    </asp:Label>--%>

                    </p>
                </td>
                <td width="100px">
                <p align="left">

                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%#Eval("ImagePath") %>'

                     style="height:100px;width:100px;border:1px solid gray;"/>
               </td>
                </p>
                </td>
                </table>
        </ItemTemplate>

        </asp:Repeater>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"

            ConnectionString="<%$ ConnectionStrings:testConnectionString %>"

            SelectCommand="SELECT [Mov_ID], [Mov_name], [StarCast], [Mov_Priority],[ImagePath] FROM [Movie]">
        </asp:SqlDataSource>
//below I want to display the related infos in the text boxes.
<asp:TextBox ID="txtMovName" runat="server"></asp:TextBox>
 <asp:TextBox ID="txtStarCast" runat="server"></asp:TextBox>

推荐答案



这篇关于如何在Repeater控件的一行中显示不同的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 23:24
查看更多