嗨,我需要在asp.net设计这样的形象代码:中继器的单选按钮列表里面在asp.net
名单来自数据库和元素来自数据库了。
,但我需要将每箱:(1个清单 - 多元素)是分离radiobox 这样我就可以在盒子里面点击任何地方和检查无线电在它
我想做出一个ASP: RadioButtonList的主数据源(用于列表)
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
</asp:RadioButtonList>
和每个无线电内作出元素的中继器在每个列表...怎么办呢? 如何在radiobuttonlist中添加中继器?
我想这个代码
:
<asp:RadioButtonList ID="radio" runat="server" DataSourceID="radio" DataTextField="name" DataValueField="id">
<asp:HiddenField runat="server" ID="hidden" value='<%#Eval("id") %>'>
</asp:HiddenField>
<asp:Repeater runat="server" ID="repeater" DataSourceID="repeaterds">
<ItemTemplate>
<%#Eval("name") %>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="repeaterds" runat="server" ConnectionString="<%$ ConnectionStrings:samy_sarc %>" SelectCommand="select * from level where (team_id = @id)">
<SelectParameters>
<asp:ControlParameter ControlID="hidden" Name="@id" PropertyName="Value" />
</SelectParameters>
</asp:SqlDataSource>
</asp:RadioButtonList>
<asp:SqlDataSource ID="radiods" runat="server" ConnectionString="<%$ ConnectionStrings:samy_sarc %>" SelectCommand="select * from team"></asp:SqlDataSource>
,但它不会工作,因为在RadioButtonList没有采取同级元素
你不需要你的单选按钮列表中的中继器。您单选按钮列表中的元素将来自您的数据绑定。 –
不明白吗??? 但可以肯定的是 sqldatasource1 ...是从数据库中获取“列表” sqldatasource2 ...是从数据库中获取每个列表的“元素” –
您是否尝试过任何操作? –