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

关于DataList嵌入DropDownList的问题

DataList 的ItemTemplate放入DropDownList
 我现在想做的是,点击DropDownList 时取得该行的ID(数据库里取到的ID)

试了很久没结果。。哪位帮帮?谢谢 --------------------编程问答-------------------- 点击DropDownList取得该行的ID???

将该行的ID主键绑定到DropDownList,还是你有其他什么想法?? --------------------编程问答--------------------
引用 1 楼 taomanman 的回复:
点击DropDownList取得该行的ID???

将该行的ID主键绑定到DropDownList,还是你有其他什么想法??


也可以把主键放在一个隐藏的Lable中。。。用Findcontrol去找控件。。得到值 --------------------编程问答--------------------
引用 2 楼 porschev 的回复:
引用 1 楼 taomanman 的回复:

点击DropDownList取得该行的ID???

将该行的ID主键绑定到DropDownList,还是你有其他什么想法??


也可以把主键放在一个隐藏的Lable中。。。用Findcontrol去找控件。。得到值


如何知道我是选择了哪行上的DropDownList呢? --------------------编程问答-------------------- 设置那个DropDownList 的 FileValue='<%#Eval("数据库里取到的ID")' --------------------编程问答--------------------

<asp:DataList ID="dlCaseList" runat="server" RepeatColumns="2" RepeatDirection="Horizontal"
                Width="100%" HorizontalAlign="Center">
                <ItemTemplate>
                    <div class="cpzspic">
                        <div class="pic">
                            <a href='ALZS.aspx?proid=<%# Eval("ID") %>'>
                                <asp:Image ID="Image1" runat="server" AlternateText='<%# Eval("ProductName") %>'
                                    ImageUrl='<%# Eval("ProductPhoto1") %>' Width="280" Height="210" border="0" /></a></div>
                        <div class="txt">
                            <a href='ALZS.aspx?proid=<%# Eval("ID") %>'><span style="color: black">
                                <asp:Label ID="Label1" runat="server" Text='<%# StringOperating.NoHTML(Eval("ProductName").ToString(),20) %>'></asp:Label></span></a>
                        </div>
                    </div>
                </ItemTemplate>
            </asp:DataList>
把A标签 换成DropDownList --------------------编程问答-------------------- DEMO
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,