手记

数据绑定控件单选框

应某人要求,简单写一下
这里用DataList举个例子:
如html代码如下:
 

1 <asp:DataList ID="dlstClubTheme" runat="server" RepeatColumns="2" RepeatLayout="table">
2                                                    <ItemTemplate>
3                                                        <asp:Label ID="lbLogoPath" runat="server" Style="display: none;" Text='<%# Eval("LogoPath") %>'></asp:Label>
4                                                        <span style="padding: 5px;">
5                                                            <img src="<%# Eval("Thumbnail") %>" width="320" height="63" alt="<%# Eval("Description") %>" /></span><br />
6                                                        <input id="rbtnClubTheme" type="radio" name="rbtnClubTheme" value='<%# Eval("LogoPath") %>' />
7                                                        <%# Eval("Name") %>
8                                                    </ItemTemplate>
9                                                </asp:DataList>单选框是rbtnClubTheme这个,关键点在于,把你想操作的东西,绑定到value去
后台取值操作如下:
 string LogoPath = Request["rbtnClubTheme"];
打完..收工...

0人推荐
随时随地看视频
慕课网APP